Self-diagnostic system for cellular-transceiver systems with remote-reporting capabilities

ABSTRACT

A self-diagnostic system for a checking all functions of a cellular-transceiver system having a cellular-interface unit, which interface unit couples a standard telephone set to a cellular transceiver, which interface unit converts the DTMF or pulse-type of dialing signals into digital format for transmission to the cellular transceiver, whereby the dialed number made on the land-type of telephone may be used to call a number over the cellular system. The present invention not only monitors and checks the proper functioning of the transceiver and associated power supply, and the like, but will also monitor and check the interface unit, and report the results to an off-site monitoring center by means of the cellular network.

CROSS REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of Ser. No. 09/160,995 filedon Sep. 25, 1998, now U.S. Pat. No. 5,966,428, which is a continuationof application Ser. No. 08/505,868, filed on Jul. 24, 1995, now U.S.Pat. No. 5,859,894, which is a continuation-in-part of application Ser.No. 08/205,029, filed on Mar. 2, 1994, now U.S. Pat. No. 5,469,494.

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to facsimile reproduction by anyone of the patent document orthe patent disclosure, as it appears in the Patent & Trademark Officepatent file or records, but otherwise reserves all copyright rightswhatsoever.

BACKGROUND OF THE INVENTION

The present invention is directed to a self-diagnosis system forchecking all functions of a cellular-transceiver system. The presentinvention has especial relevance to a cellular-interface system, such asthat disclosed in U.S. Pat. Nos. 4,658,096 and 4,737,975, which areincorporated by reference herein. In the systems of these patents, aninterface unit couples a standard telephone set, facsimile machine,modem, or other communications devices, to a cellular, or cellular-like,transceiver, which interface unit allows for normal operation of thecommunications device through the radio transceiver. The interface unitmay also convert DTMF or pulse-type of dialing signals into digitalformat for transmission to the radio transceiver, whereby the dialednumber made may be used to call a number over the radio system by meansof the transceiver. The system of the invention tests for the properoperation of all functions of the adapter interface unit, as well othercharacteristics, such as the power output of the radio transceiver,which can be varied by either signals from the transceiver or from theradio network, or the frequency at which the transceiver is utilizing,which can be changed selectively by either the transceiver or thecellular network.

The diagnostic and testing system of the present invention may be usedin any cellular-like system, such as a pure cellular system, orcellular-like systems, such ISDN and other personal communicationsystems, where a cellular-like adapter or interface unit is provided forconverting the DTMF or pulse-type of dialing signals into digital formatfor transmission to the cellular-like transceiver associated with thecellular-like system.

It is known to provide diagnostic and testing equipment for entirecellular systems. It is also known to provide a self-contained unit thattests itself. The latter is disclosed in U.S. Pat. No. 5,016,269—Rogers,which is incorporated by reference herein, which discloses acellular-telephone, emergency call-box. This patent disclosesself-diagnostics that are performed by the call-box itself. The call-boxof this patent has self-diagnostics within it, and periodically reportsthe status of items checked to a central station through the cellularnetwork. Rogers, discloses a cellular handset and transceiver andassociated auto-diagnostic system for checking on the system and forreporting back to a central station. However, this patent does notdisclose the monitoring and self-diagnostic function of a DTMFconverter, such as used in the above-mentioned U.S. Pat. Nos. 4,658,096and 4,737,975, nor does Rogers disclose the initiation of a ring-backtone from the central office to check on proper working of the system.

The types of cellular-like systems, besides the pure-type of cellularsystems, in which the present invention may be used, are those thatrelate generally to a wireless digital personal communications systemshaving a plurality of intelligent base stations and intelligent portablehandset terminals, each having a predetermined radio cell coverage area,and more particularly to a digital, radio cell, radio-telephone,personal communications system (or PCS) having a full ISDN interface,thereby facilitating direct interconnection and switching of PCS calltraffic through the ISDN interface and the public switched telephonenetwork, or any switched network, the personal communications systemhaving voice/data/image (or any combination thereof) and two-wayfull-duplex incoming and outgoing calling capability, and being fullyoperational and compatible with any modulation approach selected, withthe intercell protocol hand-off being provided through distributed logicwhich is implemented in software that is resident in the intelligentportable handset terminals, the intelligent base stations, and thepublic switched telephone network (or any switched network) equippedwith a PCS service control data base.

The increasing availability of mobile and portable communications overthe past decade is freeing business and residential users from thephysical constraints of a totally wired telecommunications network.Particularly, cellular communications systems, together with paging andother complementary services, brought true mobility totelecommunications services for the first time. Significant technicaladvances in mobile and portable technologies, as well as in newtechnologies such as digital transmission with respect to wirelesstelecommunications, have substantially expanded the number and types ofwireless telecommunications services using the radio spectrum that canbe made available to the user. These prospective services include, butare not limited to, advanced forms of cellular telephone service,advanced digital cordless telephone service, portable facsimileservices, wireless centrex, wireless private branch exchange services,and wireless local area network services, and may be used through theexisting public switched network or through alternative local wirednetworks (such as cable television systems). As such, digital personalcommunications systems can exist independently of, and in conjunctionwith, local wired networks, filling gaps that are existing in currentcommunications systems, and also in creating new markets, many of whichare yet to be defined. The advent of PCS will have a great impact on thefuture development and configuration of all telecommunications networksby significantly improving their flexibility and functionality.Accordingly, providers of PCS will have the ability to reach and serveexisting and new markets nationally in an economic and responsivemanner.

Personal communications requirements in the United States are rapidlychanging as the demand for instantaneous communications increases due toincreased mobility of the user. One of the advantages of PCS is that itwill use a single communications device to reach anyone, anytime,anywhere. PCS will facilitate increased mobility and flexibility of theuser, since this approach solves the underlying problem of being inconstant communications with user. PCS wireless will enable users not tomiss important calls, as well as reduce the time and expense inreturning calls. PCS combines the functionality of radio and the PublicSwitched Telephone Network (PSTN) technologies and infrastructure, andwill accommodate full-duplex capabilities (two-way incoming and outgoingcalling) and hand-off between radio cells (allowing users to freely movefrom one radio cell to another without interrupting the user's call). Itis important to remember that there has been a steady increasing demandfor new PCS services and technologies for numerous, sometimesincompatible, applications, namely, wireless private branch exchanges,smaller lighter portable cellular phones, portable fax machines,multi-channel cordless telephones, and additional services which aretargeting the facilitation of contacting a particular individual user(rather than contacting a particular station). Current radio equipmentand related services presently offered (i.e., cordless telephones, radiopaging, and cellular radio) cannot fully meet the demands for these newtypes of PCS services. For example, cordless telephones are used in andaround the home or office, operate on only a very few channels (10 orso) that are congested, and are limited to use in the immediate vicinityof their associated base station. Radio paging services are only one-wayand have limited capabilities. Cellular and specialized mobile radioservices cannot meet the full range of expected demand for PCS. Overtime, PCS will have standardized equipment with common modules inhardware resulting in improved reliability in the associated equipmentwhich will also be less vulnerable to transient interference fromexternal sources, have automatic call registration, automatic callforwarding, voice mail, faxing capability, easy roaming features, remotedata transfer, increased privacy protection/caller ID/class services,increased battery life, and common protocols. In order to best fulfillthis marketplace mandate, a digital PCS is a necessity. Wireless PCS mayeventually eliminate the need to have a building hard-wired forcommunications. Generally speaking, PCS will facilitate communicationsequipment with additional features. A digital PCS will facilitateimprovements in technical communications equipment, systems and design.

The present invention, therefore, may be used in those ISDN or other PCSsystems where there is provided a cellular-type adapter or interfaceboard that allows for the use of a standard, land-type telephoneinstrument in this system, or other communications device, by convertingthe DTMF or pulse signals thereof into digital format that may be sentto a PCS transceiver unit, or by providing other functions that may bespecific to the system. For example, in dedicated alarm systems whereonly outgoing calls are made by the radio transceiver, the interfaceunit need not provide ring generation, busy signal generation, and thelike. Alternatively, in those systems where only incoming calls arerequired, the interface unit need not convert dialed DTMF or pulsesignals into digital format. Such a PCS-cellular adapter also providesall of the other functions required, such as the generation of dialtone, ringing, and the like, as the cellular interface board set forthin U.S. Pat. Nos. 4,658,096 and 4,737,975.

SUMMARY OF THE INVENTION

It is, therefore, the primary objective of the present invention toprovide a self-diagnostic system for a checking all functions of acellular-transceiver system having a cellular-interface unit, whichinterface unit couples a standard, land-like telephone set, or othercommunications device, to a cellular transceiver, or to a cellular-like,such as a PCS or ISDN transceiver, which interface unit converts theDTMF or pulse-type of dialing signals into digital format fortransmission to the cellular, or cellular-like, transceiver, whereby thedialed number made on the land-type of telephone instrument, or itsequivalent, may be used to call a number over the cellular, orcellular-like, system. The present invention not only monitors andchecks the proper functioning of the cellular, or cellular-like,transceiver and associated power supply, and the like, but will alsomonitor and check the cellular, or cellular-like, interface unit, andreport the results to an off-site monitoring center by means of thecellular, or cellular-like, network.

The testing apparatus of the invention is capable of being coupled to aninterface unit which couples a communications device to a radiotransceiver for either calling out or receiving calls through the radiotransceiver, the testing apparatus having its own diagnostics formonitoring and reporting the proper functioning of the interface unit.

The testing apparatus alternately couples the diagnostics to theinterface unit, which said diagnostics simulates the functions performedby a communications device, such as a land line telephone, facsimilemachine, modem, and the like, for generating in the interface unitrespective, corresponding responses in the interface unit, in order todetermine if the interface unit is operating correctly.

The testing apparatus will also generate an off-hook signal to theinterface unit, as well as detect the presence of a dial-tone signalgenerated from the interface unit in response to the of the off-hooksignal.

The testing apparatus will also generate a DTMF signal and send thesignal to the interface unit, as well as detecting the DTMF signaloutput by the interface unit in response to the DTMF signal generated.

The testing apparatus also generates an on-hook signal to the interfaceunit, as well as an off-hook signal to the interface unit during thetime that the interface unit is generating its ring-signal, in order todetermine that the interface unit properly disconnects the ring-signalupon the answering of an incoming telephone call. The testing apparatusalso generates an outgoing telephone call through the telephone network,when said the interface unit is coupled to a transceiver, and back tothe transceiver, whereby the diagnostics causes the transceiver to makea telephone call to itself, with the diagnostics detecting thegeneration of a busy-signal by the transceiver in response to thetelephone call.

The testing may be initiated from a remote, telemaintenance center bymeans of a signal to a remote-reporting section of the auto-diagnosticunit. After the testing has been completed, the results are transmittedto the remote, telemaintenance center by means of the cellular, orcellular-like, network. The remote-reporting section will attempt totransmit the test-results data a number of times, before ceasing. If theauto-diagnostic unit is initiated locally at the site, the test-resultsmay still be transmitted to the remote, telemaintenance center by meansof the cellular, or cellular-like, network.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be more readily understood with reference to theaccompanying drawing, wherein:

FIGS. 1A and 1B show a general flow chart for the steps involved for theself-testing according to the invention;

FIG. 2 is a flow chart showing the steps involved for the subroutine ofthe self-testing of off-hook according to the invention;

FIG. 3 is a flow chart showing the steps involved for the subroutine ofthe self-testing of dial tone generation according to the invention;

FIG. 4 is a flow chart showing the steps involved for the subroutine ofthe self-testing of DTMF tone generation according to the invention;

FIGS. 5A through 5C show a flow chart for the steps involved for thesubroutine of the self-testing of ring generation according to theinvention;

FIG. 6 is a flow chart showing the steps involved for the subroutine ofthe self-testing of ring-answer process according to the invention;

FIGS. 7A and 7B show a flow chart showing the steps involved for thesubroutine of the call-test which checks for proper call-detection andanswering of an incoming call according to the invention;

FIGS. 8A and 8B show the error-code generation according to theinvention;

FIG. 9 is a flow chart showing the reset subroutine according to theinvention;

FIG. 10 is a block diagram of the system of the invention;

FIGS. 11-14 are schematics showing the various circuits used for testingthe cellular, or cellular-like interface and transceiver by simulatingthe events to be tested.

FIGS. 15-17 are flow charts showing the procedure when the test resultsof the cellular or cellular-like interface, with associated equipment,are sent to a remote telemaintenance center.

FIG. 18 is a flow chart showing the procedure when the testing of thecellular or cellular-like interface, with associated equipment, isinitiated by the remote telemaintenance center.

FIG. 19 is a flow chart showing the main-loop status verificationroutine.

DETAILED DESCRIPTION OF THE INVENTION

The auto-diagnostic maintenance system of the present invention is foruse in cellular, or cellular-like, interface boards and systems, such asthose disclosed in U.S. Pat. Nos. 4,658,096 and 4,737,975. In addition,the auto-diagnostic maintenance system of the present invention may beused with other radio-transceiver systems, such as IMTS, where there isprovided a wireless link between a base station and master stations, andwhich transceiver is associated with an adapter interface board, such asthat disclosed in U.S. Pat. Nos. 4,658,096 and 4,737,975, for example,which allows for connection and normal functioning of acommunications-type instrument, such as a land-line telephone, facsimilemachine, modem, and the like, to the radio transceiver. The interfaceunit provides a number of functions depending upon its intended use. Forexample, in dedicated alarm systems, where only outgoing calls are madeby the radio transceiver, the interface unit need not provide ringgeneration, busy signal generation, and the like, to the communicationsdevice. Alternatively, in those systems where only incoming calls arerequired, the interface unit need not convert dialed DTMF or pulsesignals into digital format. According to the invention, software isprovided which communicates with the microprocessor of the cellularinterface board or other radio-transceiver interface board, disclosed inU.S. Pat. Nos. 4,658,096 and 4,737,975, which software may be activatedeither manually or automatically for activating an auto-diagnosticinterface board of the invention, which software diagnoses the properfunctioning of all the software and hardware systems contained withinthe entire system of these above-mentioned patents. Every single itemcan be checked. For example, on the interface board, the DTMF converterwill be checked, the four-line interface to two-wire connection will bechecked, the busy-tone software will be checked, as well as all otherfunctioning aspects of the interface. In addition, the transceiver willbe checked, the battery will be checked, as well as any other aspects ofthe interface. The maintenance system of the invention is capable ofmaking a call over the cellular, or cellular-like, network to apredetermined telephone number of a central station, or base station,which central station will then send back either a tone-back or willdial the current number of the interface system to get a busy signal.This will be considered a test. The invention will also send anothertelephone number over the cellular, or cellular-like, system to call thesame or a different central station, so that it may send back a 1000hertz precision tone, whereby the software of the present invention willcompare that 1000 hertz tone to its own predetermined configuration inorder to determine whether there is a line-connection and that thecellular, or cellular-like, system is operating correctly. This is aparticularly useful system, since it allows the end-user to activate thephone in the event the user believes there is a problem with a phone.This test will then tell the telephone company whether or not the erroris at the cellular system's central office or it is a problem with thebase unit of the end-user.

According to the invention, there are two different modules. The firstone is the telemaintenance circuit and the second is the teletariffcircuit. The telemaintenance circuit generates a multiple test, as setforth below in detail, that includes a generation of a telephone call toa predetermined number. The circuit will report the results of the testto this particular number. In addition, the circuit can dial out to itsown number in order to assure that the reception and transmission of theunit is working by receiving a busy signal. These sets of tests can beinitiated by the subscriber by pressing a push button that is located onthe side of the unit. When the button is pressed, the LED located nearthe button will continue flashing identifying the test is in progress.If at the end of the test the LED continues to stay on, that indicatesthere is a problem with the unit. This test generally takes no more than40 seconds maximum. On the other hand, if the LED stops blinking andturns off, it indicates that the test was successful, and that the unitis in proper working order for the items that were checked on the test.As an option, the software and hardware provide that the test can beconducted from an outside number, provided that the transmission mediaallows it, (i.e., that the transceiver is in working order to receive aphone number).

The second circuit consists of the following: It utilizes the tariffingsignal from the cellular, or cellular-like, system and generates thecorresponding tariffing pulses for a standard table phone or pay phone.The device interprets the signal coming in from the cellular, orcellular-like, system, and does not need any local tariff. It operatesin a similar manner for generating the long tones. It can be used withany cellular, or cellular-like, system that is capable of sending thetariff signals.

Telemaintenance Modules Flow Chart Description

The user may invoke the operational test sequence by pressing theautodiagnostic push button. When invoked, the interface board control istransferred to the autodiagnostic main subroutine of the telemaintenancemodule for performing the auto-testing.

FIGS. 1A and 1B show the DO_TEST subroutine, or the autodiagnostic mainsubroutine. A number of calls to various test procedures are performed.After each procedure, the error flags are checked. In the event of anyfailure, the test sequence is stopped. Then, the status is coded, andthe result is shown to the user through four LEDs, as described below.

Referring to FIG. 1A, In STEP 1, the operational test sequence startswith the initialization of variables and flags. In STEP 2, the programcalls up the Hook_Test subroutine. In Hook_Test, the user's telephone isdisconnected from the TIP & RING lines, while the Telemaintenance Module(described below in detail) is connected in its place, to the interfaceboard, such as that disclosed in U.S. Pat. Nos. 4,658,096 and 4,737,975,in preparation for the test. STEP 3 checks for any error detected inHook_Test. If any error was found, the test sequence stops, and theprogram proceeds to STEP 14 in FIG. 1B. However, if no error wasdetected, the program calls up the Dial_Tone Test subroutine in STEP 4.STEP 5 checks for any dial tone error. If any error was found, the testsequence stops, and the program proceeds to STEP 14 in FIG. 1B. However,if no error was detected, the program calls up the next test, theDTMF_Test subroutine in STEP 6. The program continues in FIG. 1B STEP 7,where any DTMF_Tone subroutine is checked. If any error was found, thetest sequence stops and the program proceeds to STEP 14. However, if noerror was detected, the program calls up the next test, the Ring_Testsubroutine in STEP 8. STEP 9 checks for any ring error. If any error wasfound, the test sequence stops and the program proceeds to STEP 14.However, if no error was detected, the program calls up the next test,the Ring_Answer_Test subroutine in STEP 10. STEP 11 checks for anyring-answer error. If any error was found, the test sequence stops, andthe program proceeds to STEP 14. However, if no error was detected, theprogram calls up the next test, the MakeCallTest subroutine in STEP 12.STEP 13 checks for any calling-out error. If any error was found, thetest sequence stops, and the program proceeds to STEP 14. However, if noerror was detected, the program calls up the next test, theFin_Self_Test subroutine in STEP 15. If any error was found during theexecution of any subroutine, the program jumps to STEP 14. In STEP 14,the program calls up the Error_Acc subroutine. Finally, the testsequence ends after STEP 15 has cleared all variables and flags,returning the control back to the telephone set, and resuming normaloperation of the Interface.

The following explanations of FIG. 2 to FIG. 9 correspond, and describein detail, the individual test-subroutines above-mentioned.

Referring to FIG. 2, the Hook_Test subroutine (Step 2 of FIG. 1A) startswith the initialization of variables and flags in STEP 16. In STEP 17,the program clears any output of the LEDs. In STEP 18, the user'stelephone is disconnected from the TIP & RING lines of the interfaceboard, while in STEP 19, the telemaintenance module of the invention isconnected in place of the telephone. STEP 20 is a time delay to allowenough reaction time for such connection. In STEP 21, thetelemaintenance module of the invention simulates and generates anoff-hook. STEP 22 is a time delay to allow enough time for the off-hook.In STEP 23, the program checks the hook status of the interface board,which has now been coupled to the telemaintenance module. STEP 24 testfor off-hook. If off-hook is not detected, the program continues to STEP25, where the ERROR_FLAG is set and the MAIN_FLAG_ERROR is set to 1.However, if no error was detected, the program continues to STEP 26,where the dial tone is enabled for the next test shown in FIG. 3.Finally, this subroutine ends, and the program returns to the mainsubroutine Do_Test of FIGS. 1A and 1B.

Referring to FIG. 3, the Dial_Test subroutine starts with theinitialization of variables and flags in STEP 27. STEP 28 is a timedelay to allow enough time for a proper dial tone. STEP 29 tests thedial tone. If the dial tone fails, the program continues to STEP 30,where the ERROR_FLAG is set and the MAIN_FLAG_ERROR is set to 3.However, if no error was detected, the program continues to STEP 31,where the program loops back to STEP 29, testing the dial tone for atleast 711 milliseconds. After no errors have been detected after the 711milliseconds has expired, this subroutine ends, and the program returnstothe main subroutine Do_Test of FIGS. 1A and 1B.

Referring the FIG. 4, the DTMF_Test subroutine, which tests for theproper DTMF conversion into digital data by the interface board, startsin STEP 32 by disabling the dial tone from the previous subroutine test.STEP 33 sets the first DTMF tone to 0. In STEP 34, the telemaintenancemodule sends the DTMF tone corresponding to this value. STEP 35 is atime delay to allow enough time for the tone to be on. STEP 36 disablesthe DTMF tone. STEP 37 is a time delay to allow the interface to detectthe DTMF tone pulse. In STEP 38, the interface reads the tone. STEP 39checks the received DTMF tone. If the DTMF tone sent is not equal toDTMF tone received, or no DTMF tone is received, then the programcontinues to STEP 40, where the ERROR_FLAG is set, and the MAIN_FLAG₁₃ERROR is set to 4. However, if the DTMF tones are equal, the programcontinues to STEP 41, and the next DTMF digit is selected. In STEP 42,the program verifies that all DTMF tones have been tested; otherwise theprogram loops back to test the next digit. Finally, after all the DTMFtones have been tested, the subroutine ends, and the program returns tothe main subroutine called Do_Test of FIGS. 1A AND 1B.

Referring to FIGS. 5A & 5B, the Ring_Test subroutine is shown. Thissubroutine tests the timing of the two pulses of the ring generated bythe ring circuitry of the interface board. Referring to FIG. 5A, thesubroutine starts with the initialization of variables and flags in STEP43. In STEP 44, the telemaintenance module generates an on-hook. Step 45is a time delay to allow the interface to detect the on-hook. In STEP46, the interface is set to believe that an incoming call is inprogress; therefore, the interface board will generate its ringsequence. The objective of STEPS 47 to 53 is to verify that the ringstarts within the next two seconds, and that off-hook is not detected.In STEP 47, the timer is cleared. STEP 48 tests for off-hook. Ifoff-hook is detected, then the test is stopped, and the program jumps toSTEP 49 in FIG. 5C for error-indication. However, when on-hook isdetected, the program continues to STEP 51, where the telemaintenancemodule checks for the ring to be active. STEP 52 tests if the ring hasstarted. If the ring has started, the program continues to STEP 54 inFIG. 5B. However, if the ring had not yet started, the program checksthe timer in STEP 53. If the time is less than two seconds, the programkeeps looping back to STEP 48 until the ring starts. However, if the twosecond timer had expired, the test stops and the program jumps to STEP49 in FIG. 5C for indicating error. Referring to FIG. 5B, STEP 54 is atime delay. The objective of STEP 55 to STEP 59 is to verify that thering will last for at least one 1.3 seconds, and that off-hook is notdetected. In STEP 55, the timer is cleared. STEP 56 tests for on-hook.If off-hook is detected, the test stops, and the program jumps to STEP49 in FIG. 5C for indicating error. However, when on-hook is detected,the program goes to STEP 57, where the telemaintenance module checks forthe Ring to be active. STEP 58 tests if the ring has stopped. If thering has stopped, the program continues to STEP 49 in FIG. 5B. However,if the ring has not yet stopped, the program checks the timer in STEP59. If the timer is less than 1.3 seconds, the program keeps loopingback to STEP 56 until the ring stops. However, if the time has expired,the test stops, and the program jumps to STEP 49 in FIG. 5C. Theobjective of STEP 60 to STEP 62 is to verify that the ring will not lastmore than 2.5 seconds. In STEP 60, the telemaintenance module checks ifthe ring is active. STEP 61 tests if the ring has stopped. If stopped,the program jumps to STEP 63 in FIG. 5C. However, if the ring has notyet stopped, the program checks the timer in STEP 62. If the timer isless than 2.5 seconds then, the program keeps looping back to STEP 60until the ring stops. However, if the time has expired, the test stopsand the program jumps to STEP 49 in FIG. 5C.

Referring to FIG. 5C, the objective of STEP 63 to STEP 65 is to verifythat no off-hook is detected for a period of two seconds. In STEP 63,the timer is cleared. STEP 64 tests for on-hook. If off-hook isdetected, then the test stops and the program continues in STEP 49 forindicating error. However, if off-hook is not detected, the programchecks the timer in STEP 65. If the timer is less than two seconds, theprogram keeps looping back to STEP 64 until the ring starts. However, ifthe time has expired, then the program continues in STEP 66, where theprogram checks how many cycles this subroutine has tested the ring. Ifthe ring has been tested for only one cycle, the program continues inSTEP 67, where the flag called Ring_Second is set. Thereafter, theprogram loops back up to STEP 47 in order to test the ring for a secondtime. However, if the ring has been tested twice, the subroutine endsand the program returns to the main subroutine called Do_Test. If anerror was detected during any part of the Ring_Test subroutine, theprogram jumps to STEP 49. STEP 49 clears the incoming call status;therefore, the ring sequence stops. Then, the program continues in STEP50, where the ERROR_FLAG is set and the MAIN_FLAG_ERROR is set to 5.Then, the subroutine ends, and the program returns to the mainsubroutine called Do_Test.

Referring to FIG. 6, the Ring_Answer_Test subroutine is shown. Thissubroutine tests the response of the interface board when an off-hook ispresented to the interface board during the ring-cycle, when answeringthe telephone for an incoming call. The objective of STEP 68 to STEP 69is to verify that the ring will start within the next two seconds andthat off-hook is not detected. In STEP 68, the timer is cleared. STEP 69tests for on-hook. If off-hook is detected, then the test stops and theprogram jumps to STEP 73. However, if on-hook is detected, the programcontinues with the ring active. STEP 71 tests if the ring has started.If the ring has started, the program continues to STEP 74. However, ifthe ring has not yet started, the program checks the timer in STEP 72.If the timer is less than two seconds, then the program loops back toSTEP 69 waiting for the ring to start. However, if the two-second timerhas expired, the test stops and the program jumps to STEP 73. In STEP74, the telemaintenance module generates an off-hook. STEP 75 is a timedelay that allows the interface board to detect the off-hook. In STEP76, the interface checks the hook-status. If off-hook is not detected inSTEP 77, then the test stops and the program jumps to STEP 73. However,if the interface board detects the off-hook, the program continues inSTEP 78. If an error was detected during any part of theRing_Answer_Test subroutine, then the program jumps to STEP 73, wherethe ERROR_FLAG is set and the MAIN_FLAG_ERROR is set to 6. Then, theprogram continues in STEP 78. In STEP 78, the incoming call status iscleared; therefore, the interface board will stop the ring sequence.Then, the subroutine ends, and the program returns to the mainsubroutine called Do_Test.

Referring to FIGS. 7A & 7B, the Call_Test subroutine is shown. Thissubroutine tests the cellular, or cellular-like, transceiver coupled tothe interface board, by first checking the power, and, secondly,generating a call to its own telephone number. Referring to FIG. 7A,STEP 79 checks if the transceiver's power is “on”. If the power is“off”, the MAIN1_FLAG_ERROR is set to 1 in STEP 81, and then the programjumps to STEP 93 in FIG. 7B. However, if the power is “on”, the programproceeds to STEP 82, where the interface board requests and gets thetransceiver's assigned telephone number. STEP 83 is a time delay toallow reaction time for the transceiver. In STEP 84, the interface boardgenerates a telephone call to itself. STEP 85 is a time delay to allowtime for connection between the cellular, or cellular-like, network andthe transceiver. In STEP 86, the interface board requests the IN USEstatus from the transceiver. STEP 87 checks the status of the call. Ifthe status is not IN USE, the MAIN1_FLAG_ERROR is set to 4 in STEP 88,and then the program jumps to STEP 93 in FIG. 7B. However, if thetransceiver is IN USE, the program proceeds to STEP 89 in FIG. 7B. InFIG. 7B, the telemaintenance module checks the busy-tone in STEP 89. Ifthe busy-tone is detected in STEP 90, then the program jumps to STEP 93.for an indication that all is operating correctly. However, if thebusy-tone is not detected, the program proceeds to STEP 91, where thetimer is checked. If the timer is less than 18.2 seconds, then theprogram loops back to STEP 86. This allows more time to the cellular, orcellular-like, network to return the busy-response. However, if the timehas expired, the program proceeds to STEP 92, where the MAIN1_FLAG_ERRORis set to 3. In STEP 93, the interface board sends an END of call to thetransceiver. Then, the telemaintenance module presents an on-hook to theinterface board in STEP 94. Finally, the sub-routine ends and theprogram returns to the main subroutine Do_Test.

The objective of FIG. 8A and FIG. 8B is to generate a an ERROR_CODE fromthe previously-described error flags, in such a way that the results canbe output later through LEDs. Referring to FIG. 8A, the subroutinestarts checking the value of one of two error flags, theMAIN_FLAG_ERROR. STEP 95 checks if MAIN_FLAG_ERROR is equal 1 or HookSlic Error. If true, the ERROR_CODE is set to 1 in STEP 96, and then theprogram returns to the main subroutine Do_Test. However, if false, theprogram continues in STEP 97. STEP 97 checks if MAIN_FLAG_ERROR is equal2 or hook-ring error. If true, the ERROR_CODE is set to 2 in STEP 98,and then the program returns to the main subroutine Do_Test. However, iffalse, the program continues in STEP 99. STEP 99 checks ifMAIN_FLAG_ERROR is equal 3 or dial-tone error. If true, the ERROR_CODEis set to 3 in STEP 100, and then the program returns to the mainsubroutine Do_Test. However, if false, the program continues in STEP101. STEP 101 checks if MAIN_FLAG_ERROR is equal 4 or DTMF tone error.If true, the ERROR₁₃ CODE is set to 4 in Step 102, and then the programreturns to the main subroutine Do_Test. However, if false, the programcontinues in STEP 103. STEP 103 checks if MAIN_FLAG_ERROR is equal 5 orring-detection error. If true, the ERROR_CODE is set to 5 in STEP 104,and then the program returns to the main subroutine Do_Test. However, iffalse, the program continues in STEP 105. STEP 105 checks ifMAIN_FLAG_ERROR is equal 6 or ring-answer error. If true, the ERROR_CODEis set to 6 in STEP 106, and then the program returns to the mainsubroutine Do_Test. However, if false, the program jumps to STEP 107 inFIG. 8B. In FIG. 8B, the subroutine starts checking the value of thesecond error flag, the MAIN1_FLAG_ERROR. STEP 107 checks ifMAIN1_FLAG_ERROR is equal 1 or power-radio error. If true, theERROR_CODE is set to 7 in STEP 108, and then the program returns to themain subroutine Do_Test. However, if false, the program continues inSTEP 109. STEP 109 checks if MAIN1_FLAG_ERROR is equal 2 or call error.If true, the ERROR_CODE is set to 8 in STEP 110, and then the programreturns to the main subroutine Do_Test. However, if false, the programcontinues in STEP 111. STEP 111 checks if MAIN1_FLAG_ERROR is equal 3 orbusy-tone error. If true, the ERROR_CODE is set to 9 in STEP 112, andthen the program returns to the main subroutine Do_Test. However, iffalse, the program continues in STEP 113. STEP 113 checks ifMAIN1_FLAG_ERROR is equal 4 or “In Use” error. If true, the ERROR_CODEis set to 10 in Step 114, and then the program returns to the mainsubroutine Do-Test. However, if false, the program continues in STEP115. STEP 115 checks if MAIN1_FLAG_ERROR is equal 5 or 1000 Hz. error.If true, the ERROR_CODE is set to 11 to STEP 116 Do_Test. However, iffalse, the program returns to the main subroutine Do_Test.

Referring FIG. 9, FIN_SELF subroutine, the objective of this subroutineis to reset the interface board to its normal functioning, and to showthe end of the test by flashing the LEDs four times. The subroutinestarts with STEP 117, where the telemaintenance module generates anon-hook. In STEP 118, all variables and error flags are cleared. STEP119 turns off all LEDs. STEP 120 is a time delay. STEP 121 turns on allLED's . STEP 122 is a time delay. STEP 123 permits to loop back to STEP119, so that the flashing is performed four times. Finally, STEP 124clears all LEDs, and then the program returns to the main subroutineDo_Test of FIGS. 1A & 1B.

The following is a description of the operation of the of the invention,with reference being had to FIG. 15, which is followed by thedescription of the individual circuits used for carrying out theabove-described auto-test, which is followed by the software program forcarrying out the operations detailed therein.

Referring to FIG. 10, there is shown a block diagram of thetelemaintenance circuit module, which is indicated generally byreference numeral 10. The telemaintenance circuit module 10 is installedin a cellular, or cellular-like, adaptor system such as that disclosedin U.S. Pat. Nos. 4,658,096 and 4,737,975, and is designed to initiate aprocess of automatic testing from the facilities of the telephonesubscriber by push-button activation or by automatic testing atintervals of approximately 12 hours, according to the flow charts ofFIGS. 1A-9, as described above in detail. The final result of thisautotest will be provided to the user by way of an orange-colored lightindicator (LED) installed in the right wall of the cellular, orcellular-like, adaptor. The telemaintenance circuit module 10 has thecapacity of reporting the results of the test to a remote servicecenter. This report will be accomplished by way of an automatic call tothe assigned number for the service center. This function requires thatthe service center be equipped with the hardware and software necessaryto establish communication, and to interpret the received reports. Theautodiagnostic test of the invention verifies the correct operation ofthe cellular, or cellular-like, adaptor, including its components, suchas: principal circuits of the interface card, data cable between theradio and interface, transmission line, antenna, cellular, orcellular-like, transceiver, tollcharge circuit and supply source. Thetelemaintenance circuit has been configured in order to call the samenumber assigned to the adaptor transceiver where the test is carriedout. The autodiagnostic circuit is programmed to detect a busy orline-congestion signal as an indication that a call can be made, andthat the transmission circuit is operating correctly.

The telemaintenance circuit module 10 is designed to be utilized in thecellular, or cellular-like, adaptor unit in order to verify that thelatter is operating correctly without necessitating sending technicalpersonnel to the site where the equipment is installed. Thetelemaintenance circuit module 10 is supplied directly from thecellular, or cellular-like, interface board. The advancedtelemaintenance circuit is not an autonomous circuit. Its operationdepends on control signals that it receives from the auditor localizedin the cellular, or cellular-like, interface board. The auditor comparesthe results of the tests with the parameters of the system's operatingprogram. The autodiagnostic circuit of the telemaintenance circuitmodule 10 conducts the following tests: Answering errors [wrongnumber]—This test is conducted by two alternate methods; ringvoltage—the circuit generates a call and detects the presence of ringvoltage that the interface card produces; Call answer—verifies that thering stops once it is answered; Dial tone—verifies the presence of thedial tone; MFTD Operation—assures that the interface card properlydetects the receipt of the MFTD [multifrequency tone detector] tones;transceiver test; reception circuit test; transmission circuit test;tollcharge circuit test—verifies the frequency characteristic of thepulses generated at 12 KHz; transceiver power supply; performance of thepower supply system. These tests have been detailed above in thedescription of the flow charts of FIGS. 1A to 9.

The telemaintenance circuit module 10 is connected to the conventional,cellular, or cellular-like, interface card by a 20-position plugconnector. The test routine is initiated by way of a manual switchinstalled on the right side of the adaptor box. Upon finding anabnormality in the operation of the telephone, as, for example, nothearing the dial tone upon picking up the receiver, the subscriberproceeds to the adaptor box and presses a test pushbutton, which isproperly identified. The telemaintenance circuit module 10 proceeds todisconnect the connection of the subscriber's telephone to the cellular,or cellular-like, interface board, and to accomplish a sequence ofautodiagnostic tests, as described above. The telemaintenance circuitmodule 10 is also programmed to initiate the test routine automaticallyat intervals of approximately. 12 hours from the moment the cellular, orcellular-like, interface board is turned on. When the test isautomatically initiated, the sequence of the outgoing test call is notgenerated. By means of further development, the autodiagnostic teststart-up function can be initiated from a remote center. Thistelemaintenance function carries a modification to the operatingsoftware of the interface board, and has an auxiliary development forthe hardware and software of the telemaintenance center. Upon initiatingthe autotest routine, the orange-colored light indicator (LED) willflash to indicate to the subscriber that the test is taking place. Thereare pauses in the indicate flash of approximately one second betweeneach of the tests accomplished by the circuit. The complete test willlast approximately 40 seconds. Upon finishing the test, the success ofthe test is shown by the light indicator remaining on. In this case, theexisting problem would be related to the wiring or to the telephoneapparatus connected to the cellular, or cellular-like, interface board.Once the light indicator stays lit continuously, the cellular, orcellular-like, interface board returns to its normal operatingcondition. When a breakdown of the cellular, or cellular-like, interfaceboard is determined from the tests, the light indicator will beextinguished indefinitely. This indicates to the user that a breakdownexists in the cellular, or cellular-like, adaptor. Once the test routineis finished, the cellular, or cellular-like, interface board returns toits normal operating condition irrespective of what breakdown wasdetected. The user may continue using the adaptor even with the existinglimitations due to the detected breakdown.

The 4-light indicator (LEDs) in the circuit of the cellular, orcellular-like, interface board will be utilized to identify the detectedbreakdown. This presentation is of help to the service technician whocan gain access to the inside of the box in order to ascertain thenature of a possible breakdown. The combination of “on” and “off” LED'swill identify the primary detected breakdown in the test. Thiscombination will remain lit for 60 seconds once the test ends. A list ofthe possible breakdown codes indicated by the LED's of the cellular, orcellular-like, interface board is given below.

On concluding the autotest, a call will be initiated to thetelemaintenance center if a breakdown has been detected. Once thecommunication is established, the detected breakdown will be reported.This telemaintenance function will allow the establishment of a databasefor each unit. If the test was manually initiated by way of thepushbutton, the complete result of the finished test, irrespective ofwhether breakdowns were detected, will be reported to thetelemaintenance center.

The following is a listing of the codes as displayed by the LED array:

4.10 ERROR CODE

Type of Error LED 5 LED 4 LED 3 LED 2 No Breakdowns OFF OFF OFF OFF LoopError OFF OFF OFF ON Loop Error OFF OFF ON OFF Dial Tone OFF OFF ON ONMFTD Detector OFF ON OFF OFF Ring Detector OFF ON ON ON Call Answer OFFON ON OFF Transceiver Feed OFF ON ON ON Transmitter (Call) ON OFF OFF ONReceiver (Busy) ON OFF OFF OFF Tone Detection at 12 KHz ON OFF ON ONFeed from Power Source ON OFF ON OFF “NO SERVICE” ON ON ON ONTransmission Circuit ON ON ON OFF Undetermined ON ON OFF ON UndeterminedON ON OFF OFF

The sequence of the autotest is as follows. The first actionaccomplished by the telemaintenance circuit is disconnecting theinstallation of the subscriber. Then, a condition of “answer thesubscriber's telephone” is simulated. In this condition, the correctdetection of the loop closing can be checked, thus generating the dialtone. Then, the correct generation of the dial tone can be verifiedwithin a minimum frequency and level range. Next, a test of themulti-frequency tone detector of MFTD begins. This consists of thetelemaintenance circuit module's autodiagnostic card generating theentire sequence of 16 MFTD tones, sending it to the conventional,cellular, or cellular-like, interface board of the cellular, orcellular-like, adapter, and verifying that these tones are correctlydetected. Then, a test is carried out for verifying the correctfunctioning of the ring generator. The ring-current is generated,verifying its frequency and level within an established minimum range.Then, the condition of answering the telephone is simulated anew, orcall answer, in order to check the function of the ring circuit, whichshould deactivate before the telephone is answered. The next testdetects the capacity of the tollcharge circuit to generate pulses at 12KHz within a minimum frequency and level range, for the case ofcellular, or cellular-like, -adapter pay telephones. The pulsesgenerated by the tollcharge card will be detected by a precise pulsedetector in the telemaintenance circuit module 10 in a manner that iswell-known. For cellular, or cellular-like, adapter systems that do nothave a tollcharge module, then the connector J1.3 of the cellular, orcellular-like, interface card is configured with the bridge removed. Thebridge will be installed in those units that have the tollcharge moduleinstalled.

The next tests verify the functioning of the cellular, or cellular-like,transceiver. First, supply to the transceiver is verified. This test ismade by means of the detection of +12 VDC derived from the dataconnector of the transceiver. Secondly, the transceiver is verified thatit is in a condition of providing cellular, or cellular-like,access-service, indicated by the absence of the “NO SERVICE” signal. Thepresence of the “NO SERVICE” signal will be recognized as a breakdown.This condition can be caused by a cover defect, and not just a breakdownof the cellular, or cellular-like, transceiver. Next, a call isgenerated through the cellular, or cellular-like, network, to the numberowned by the subscriber. The transceiver function is checked in thismanner, detecting it as receiving a busy signal from the system, since,it is calling itself. In the case of finding the network congested, thiswill inform the transceiver of a “PATH ENGAGED” condition. Thetransceiver then generates a congestion (busy) tone. This tone isinterpreted as a correct transceiver function, the same as the busysignal. This test will be accomplished only when the routine is manuallyinitiated by pushbutton. This test will not be accomplished in unitsthat initiate the process automatically. The voltage of the supplysystem power is also checked. If the voltage is less than 13.5 VDC, abreakdown in the supply source is detected.

In FIG. 10, the main telemaintenance module 10 is coupled to thestandard cellular, or cellular-like, adapter or interface board 14.Within the telemaintenance module, there are a number of individualcircuits that are used for performing the self-diagnosing tests, asdescribed above. These circuits are: The busy-signal detector 16 usedduring the test for proper reception of a call made by thetelemaintenance module during the call-back self-testing described abovewith reference to FIG. 7A; the 12,000-cycle detector circuit 18 used fortollcharge testing, which verifies the frequency characteristic of thepulses generated at 12 KHz; the MFTD generator circuit 20, whichgenerates the DTMF signals converted by the cellular, or cellular-like,interface card, as described above with reference to FIG. 4; thering-signal detector circuit 22, which is used for detecting thering-signal generated by the cellular, or cellular-like, adapterinterface board during the ring-test and ring-answer subroutines,described above with reference to FIGS. 5A through 6; the dial-tonedetector circuit 24, which detects for the proper generation of dialtone by the cellular, or cellular-like, adapter interface board 14, asdescribed above with reference to FIG. 3; the voltage-detector circuit28 for testing the power supply of the transceiver and the entiresystem; and the telemaintenance control unit 30, which is the controlunit and which is also used for calling and reporting to the centralreporting station the results of the autotest. The actual configurationof each of the above-noted circuits is shown in FIGS. 11-14, which aredescribed below in detail.

Referring now to the FIGS. 11-14, there are shown the hardware circuitsfor performing the simulation tests described above during the entireself-testing process. Referring to FIG. 11, there is shown theinterconnection circuit of the telemaintenance circuit module 10. Thepart of the schematic of FIG. 11 labeled “A” shows the location wherethe telemaintenance circuit is hooked into the lines of TIP & RING ofthe conventional cellular, or cellular-like, adapter interface board.The relay labeled “RELY1” is used to disconnect the user's telephonefrom the cellular, or cellular-like, interface during the maintenanceoperation test. Instead thereof, the telemaintenance circuit is hookedup to the TIP & RING in order to perform the tests. When the“ENABLE-TEST” signal is set to HI, the transistor Q3 is forced intosaturation, and then energizes RELY1, connecting the maintenance circuitto the TIP and RING. The part of the schematic of FIG. 11 labeled “B”shows the user-telephone hook-up connector, where the user's telephonecan be hooked to the board in two possible ways. J1 is a two terminalconnector of P1 of a normal RJ11 telephone type socket.

The section of the schematic of FIG. 11 labeled “C” is the audiointerface circuit, which is used as an interface between the TIP andRING lines and the Audio. T1 is a telephone matching transformer. Itsfunction is to maintain similar AC and DC current characteristics of atelephone while allowing audio signals to be received and transmitted.Zener diodes D1 & D2 are used to cut up any signal with voltages higherthan +/−4.5V. Also included is an opto-isolator SSR1 that, inconjunction with transistor Q4, offers a mechanism to close the TIP &RING circuit. When the “Conn-Loop” signal is set to HI, the transistorQ4 is forced into saturation, which then energizes SSR1, closing thecircuit and performing an off-hook.

The section of the schematic of FIG. 11 labeled “D” is thering-detection circuit, which contains two main parts: U2, which is aring-detector integrated circuit, and U9 with opto-isolator thatprovides a proper Cmos signal level output. A current is provide betweenpin 4 and pin 7 of U2 as an output signal when a ring-voltage is presentat the TIP & RING lines. This current is then transformed by theopto-isolator U9, which then provides an active Low signal to the I/O.

The section of the schematic of FIG. 11 labeled “E” shows theloop-current detector, which contains an opto-isolator used to detectedloop current. When the test is enabled (the “Enable-Test” signal is HIin part A) and an off-hook is performed, (the “Conn-Loop” signal is HIin part C), the TIP & RING lines go into close-circuit providing anoff-hook current. This current is then transformed by U17 into an activeLow signal to the I/O.

The section of the schematic of FIG. 11 labeled “F” is the input-outputaudio circuitry composed of ¼ of U1, an operational amplifier IC. Themain function of this circuitry is to isolate and pre-amplify theincoming audio signals. The output of this circuit is called “Audio-In”.Also, in this section the DTMF output generated by the telemaintenancecircuit of the invention is sent to the TIP & RING lines. This DTMFsignal is labeled as “Tone-Out”.

Referring now to FIG. 12, the part of the schematic of FIG. 12 labeled“G” is the DTMF tone generator, which is composed of U4, a DTMF tonegenerator, and ¼ of U1 used as an output amplifier. To generate a DTMFtone, first a four bit code is presented to the input pins labeled“DTMFO-OUT”, “DTMF1-OUT”, “DTMF2-OUT” and “DTMF4-OUT” in U4. Then, whilekeeping the four bit code, the enable signal labeled “DTMF-OUT” ischanged from Low to HI level, thus allowing the tone to be generated.The audio is output at “TONE-OUT” after the audio had been amplified byU1:C. To stop the tone, the “DTMF-OUT” signal is returned to low level.

The section of the schematic of FIG. 12 labeled “H” is the input/outputport, the I/O Port IC labeled U8. This integrated circuit is used by themicrocontroller of the cellular, or cellular-like, interface board toread the input data and to control all of the output of thetelemaintenance module. Ports A and C are input ports, while port B isan output port. Jumper J4 is the selector for the automatic periodictest with possible selections of 12 or 24 hours. J5 is used as an enablefor the call to the “automatic answer”.

The sections of the schematic of FIG. 12 labeled “I.1” and “I.2” are thepower, data and control connectors, and contain J2, a 2 by 10 maleheader connector used to bring power, as well to send and receive datato the I/O Port. It also includes a 4 pin header connector for theexternal LED used to show the status of the test, and an external pushbutton used to manually activate the test. The section of the schematicof FIG. 12 labeled “J” is the power regulator, and has U7, a 5 Voltfix-positive regulator that supplies the voltage necessary for thedigital circuits.

The telemaintenance module 10 contains six single tone detectors usedfor testing the receiving audio path, frequency and timing cadence ofROH, Dial, Busy and Congestion tones. Each of the tone detectors iscomposed of an operational amplifier and a single tone detector IC. Theinput of the Opamp is connected to line “AUDIO-IN”. The frequency ofdetection is set by a resistor located between pin 5 and 6 and acapacitor located between pin 6 and ground. When a valid tone matchesthe programmed tone by the RC, the tone detector output pin is forcedfrom HI to Low.

Section “K” of FIG. 12 shows the dial-tone detector circuit. When avalid dial tone is present at the input of U3, the “DIAL-DETECT” line isforced to go Low. Section “L” shows the busy-tone detector circuit. Whena valid busy tone is present at the input of U6, the “BUSY-DETECT” lineis forced to go Low.

Section “M” of FIG. 13 shows a 400 Hz. tone-detector circuit. When avalid 400 Hz. tone is present at the input of U14, the “400-DETECT” lineis forced to go Low.

Section “N” of FIG. 14 shows a 800 Hz. tone-detector circuit. When avalid 800 Hz. tone is present at the input of U13, the “800-DETECT” lineis forced Low. Section “O” shows a 1020 Hz. tone-detector circuit. Whena valid 1020 Hz. tone is present at the input of U16, the “1020-DETECT”line is forced Low. Section “P” shows a 12 KHz. tone-detector circuit.When a valid 12 KHz. tone is present at the input of U12, the “12KHz-DETECT” line is forced Low.

Section “Q” of FIG. 13 shows a DTMF tone decoder, which is composed ofU11, a DTMF tone detector and ¼ of U1 used as an input pre-amplifier.When a valid DTMF tone is present at the input pin (IN-), the controlline “DTMF-STROBE” s forced Low, while the IC is decoding. After thetone has been decoded, a four bit code is output to pins labeled“DTMFO-IN”, “DTMF1-IN”, “DTMF2-IN” and “DTMF4-IN” in U11. The controlline “DTMF-STROBE” is then returned to HI again. Section R is an ACmonitor, having U10, a 4.5V under-voltage detector. Resistors R17 andR33 form a voltage divider that will make U10 sense voltage under 13volts instead of 4.5 volts. The circuit works on the assumption thatwhen the supply voltage comes from the power supply, a 14V is present atthe entrance of the telemaintenance module. On the event of an AC powerfailure, the voltage drops to the battery back-up level, which is notgreater than 13 volts. The circuit will detect the drop, and U10 willdrive line labeled “AC-DETECT” to Low.

Referring to FIGS. 15-19, there are shown in FIGS. 16-18 the flow chartsfor use in reporting the results of the self-diagnostic tests to theremote, central telemaintenance center, while there is shown in FIG. 15a flow chart for initiating the self-diagnostic testing by the remove,central telemaintenance center.

Referring to FIG. 14, starting at the top (block 200) this is the entrypoint of the. telemaintenance center calling routine. In STEP 1 (block202), the transmission retry count variable is set to 3. This courtdetermines the number of times a transmission is sent to theTelemaintenance Center before aborting the call. In STEP 2 (block 204),the call calls incomplete bit is reset. This clears any previous pendingcall, assuming a previous call was in progress and did not complete,setting a call-back flag. In STEP 3 (decision block 206), before callingthe telemaintenance center, the system's service flag is checked. Ifthere is a NO-SERVICE condition, the call aborts, setting the call_backflag. In STEP 4 (block 208), the telemaintenance center telephone numberis recalled from the transceiver memory. In STEP 5 (block 210), theprogram instructs the radio to establish the call. Referring to FIG. 17,in STEP 8 (block 212), a counter/timer is set at the maximum time(timeout) the program will wait before dropping the call when atransmission/reception error occurs from the telemaintenance center. InSTEP 10 (block 216), the NO-SERVICE and INUSE flags are tested to see ifthe call has been dropped. If the call has been dropped, the programtransfers execution to STEP 6 (block 211) of FIG. 16. In STEP 11 (block218), and after receiving some signal on the receive audio channel, thesignal received is checked for specific cadences like BUSY, and then thecall is aborted, transferring execution to STEP 7, for the EXIT ROUTINE(see FIG. 15). In STEP 12 (block 220), and after receiving (block 220),and after receiving some signal on the receive audio channel, the signalreceived is checked for the cadence of the signal RINGBACK. If theRINGBACK signal is detected, the program transfers execution back toSTEP 9 (block 214) to check to see if the one-minute timeout has beencompleted before entering the EXIT ROUTINE. In STEP 13 (block 222), thesignal is checked for the presence of a 1020 Hz tone. If the tone ispresent for at least 100 ms, the program transfers execution to STEP 14in FIG. 17 for the start of the message-sending routine. In STEP 14(block 224, FIG. 17), a transmission retry count down variable is set to3. This counter determines the maximum number of retransmissions to thetelemaintenance center. In STEP 15 (block 226), the program transmitsthe message to the telemaintenance center. In STEP 16 (block 228), a 10second timeout counter is set to zero his counter determines that theprogram will wait 10 seconds for the acknowledgement-tone (1020 Hz) fromthe Telemaintenance Center. If this tone is not received within 10seconds (STEP 16, block 232, the program continues with STEP 19. In STEP19 (block 234), the transmission retry counter (initially set at 3) isdecremented. In STEP 20 (block 236), this counter is compared againstzero. If the value of the counter is zero, the call-back flag is set,and then the program transfers execution to STEP 7 for carrying out theEXIT ROUTINE. In STEP 17 (decision block 230), if after transmitting themessage a 1020 Hz tone is received from the telemaintenance center,meaning a message-received acknowledgement, the call_back flag is reset,ending the call successfully.

Referring to FIG. 18, the flow chart for the operation of the system ofthe invention by the initiation of the self-diagnostic testing by theremote telemaintenance center is shown. The objective of STEP 23 (block240) is to denote that the Radio Interrupt Processing Routine does othertasks than the task described hereinbelow. These tasks are associatedwith the basic interface functions. In STEP 24 (decision block 242) amessage-completion bit is checked. If a message is not received, theprogram transfers execution to STEP 29 (block 244), where the interruptservicing routine is carried out. In STEP 25 (block, 246), the incomingdata byte of the radio is compared against the remote telesupervisorytest activation code, sent by the telemaintenance center across thesystem. If the telesupervisory test activation code is received from thetelemaintenance center, the program executes STEP 26 (block 248), wherea flag is set on the call_back variable to indicate that the test hasbeen initiated by the telemaintenance center. In STEP 27 (block 250),the test_enable flag is set to enable the test process. In STEP 28(block 252), the variables associated with the test results arepre-defined to an initial state before the self-diagnostic test starts.

Referring to FIG. 19, there is shown the HOOKCHK routine for theverification of the status flags. The objective of STEP 30 (block 260)is to RESET the watchdog timer to prevent CPU-reset. In STEP 31(decision block 262), the test enable flag is tested. If the test_enableflag is set to 1, meaning that the test has been enabled (which is setby a manual, timer-automatic or telesupervisory), the program branchesto the DO-TEST process STEP 34 (block 264). After executing the DO-TESTprocess, the program returns to the HOOKCHK loop. In STEP 32 (decisionblock 266), the OFFHOOK flag is tested. If the OFFHOOK flag is set to 1,meaning that the telephone has been OFF-Hooked, the program branches tothe OFFHOOK process (STEP 35, block 268). After exiting the OFFHOOKprocess, the programs return to the HOOKCHK loop. In STEP 33 (decisionblock 270), the FANSWER flag is tested. If the FANSWER flag is set,meaning that an incoming call has been received and that the telephonehas been OFFHOOK, the program branches to the RING_ANSWER process (STEP36, BLOCK 272). After exiting the RING_ANSWER process, the programsreturn to the HOOKCHK loop.

The following is a listing of the source code for performingself-diagnostics of the invention, followed by the source code forperforming the reporting of the self-diagnostic test-results to theremote, central telemaintenance center, and for the initiation of theself-diagnostic testing by the remote, central telemaintenance center.

$nopi nosb db noge nomo nopr ep $nolist $include(reg252.pdf) $list;************************************************************** ; * ;Maxjack by Alexis V. Torres for Telular International, Inc. * ; (C)Copyright Telular International, Inc. 1993-1995 * ; Telephone/cellularinterface: * ; Main program with the maintenance board * ; * ; 11-29-92maint.asm *;************************************************************** ; Theseare the universal landline phone key codes. zero equ 0ah ; [0] key codestar equ 0bh ; [*] key code pound equ 0ch ; [#] key code ; Buffer areapointers for the HS display and the TRU messages. dspbuf_start equ 80h ;Start of 16 byte LCD display buffer dspbuf_end equ 90h ; End of LCDdisplay buffer msgbuf_start equ 90h ; Start of TRU (etc) msg buffermsgbuf_end equ 0h ; End of TRU msg buffer main_flag equ 0b0h ; useindirect address for test flag ;hook_slic 1 ;dial 2 ;dtmf_(—) 3;ring_test 4 ;ans_test 5 main_flag_error equ 0b1h ;hook_slic_error 1 ;hook error ;hook_ring_error 2 ; hook error ;dial_error 3 ; dial toneerror ;dtmf_error 4 ; dtmf error ;ring_test_error 5 ; ring error;ans_test_error 6 ; ring answer error main1_flag equ 0b2h ; ditto;power_radio 1 ; power radio error ;call_test 2 ; call error ;call_tone3 ; call audio error main1_flag_error equ 0b3h ; ditto;power_radio_error 1 ; spare ;call_test_error 2 ; call spare error;call_tone_error 3 ; call audio spare error ;inuse 4 ; inuse error ;1000hz 5 ; 1000hz error error_code equ 0b4h ; final indication LEDindication ;hook_slic_error 1 ; hook ;hook_ring_error 2 ; hook;dial_error 3 ; dial ;dtmf_error 4 ; dtmf ;ring_test_error 5 ; ring;ans_test_error 6 ; ring answer ;power_radio_error 7 ; radio power;call_test_error 8 ; call ;call_tone_error 9 ; call audio ;inuse 10 ;inuse ;1000hz 11 ; 1000 hz cero equ 00h uno equ 08h dos equ 04h tres equ0ch cuatro equ 02h cinco equ 0ah seis equ 06h siete equ 0eh ocho equ 01hnueve equ 09h estrella equ 0dh libra equ 03h;************************************************* ; ; Internal Ramvariable definitions ;;************************************************* ; Registers occupybytes 00h-07h (reg. bank 0) ;r0 storage pointer (also address pointerfor I/O expander) ;r1 pointer to storage of data from TRU ;r2 digitcount ;r3 delay loop for bus timer ;r4 delay loop for bus timer ;r5 usedin rohtone timer ;r6 used in send_time ;r7 used in rohtone timer ;Variable storage locations time_off1 data 10h ;Measures off-hook timetime_off2 data 11h ;Measures off-hook time time_off3 data 12h ;Measuresoff-hook time time_on1 data 13h ;Measures on-hook time time_on2 data 14h;Measures on-hook time pulse_digit data 15h ;Value of pulse dialed digitin_use_off_timer data 16h ;Checks for 2 sec after in use lamp ; goes outto do cpd ring_timer data 17h ;Timer checks time between ringsbell_timer data 18h ;Timer generates 20hz for ringer bell_timer2 data19h ;Timer for ringer gndstart_timer1 data 1ah ;Releases GS line if noconnect in 1se gndstart_timer2 data 1bh ;Same as above ;highpoint data1ch ;Stores dph for tone tables ;lowpoint data 1dh ;Stores dpl for tonetables highpoint data 35h ;Stores dph for tone tables lowpoint data 36h:Stores dpl for tone tables test_min data 1eh ;free data 1fh;**************************************************************** ; ;The Ram area 20h thru 29h is reserved for use by the main ; moduleeither as data BYTES or individual BITS ;;**************************************************************** flagsDATA 20h ;This byte contains the following flags ; as individuallyaddressable bits fhook bit 00h ;Off hook flag set by coming off hook, ;cleared when processed fsend bit 01h ;Send flag fflash bit 02h ;Flashflag fhang bit 03h ;Hang up flag ftime bit 04h ;40 second timer flagfdigit bit 05h ;Flag for pulse dig input fonhook bit 06h ;On hook flagset 700msec ;After hup, cleared by coming off-hook fdtmfin bit 07h ;Dtmfinput flag inds DATA 21h ;Indicators - this byte contains the ;following bits: roam bit 08h ;Roam indicator noserv bit 09h ;No serviceindicator lock bit 0ah ;Lock indicator rdis bit 0bh ;Reset digit displayhorn bit 0ch ;Horn indicator f_init bit 0dh ;Set by TRU only! (1 = initsdone) f_start bit 0eh ; 1 = onhook ints disabled for 500ms test_enable bit 0fh ; auto test ; after first offhook to deglitch the ; contactbounces indasc DATA 22h ;Indicators & audio switch control this ; bytecontains the following bits: inuse bit 10h ;In use indicator ap1 bit 11h;Audio path ap2 bit 12h ;Audio path test_end  bit 13h ;not_error bit 14h; no error flag for self test return_ring bit 15h error_flag bit 16h ;self test error ring_second bit 17h io_status DATA 23h ; Bits 18h-1fhstrobe bit 1ch flags2 DATA 24h ; Bits 20h-27h fdig_ready bit 20h ;Digitready flag fanswer  bit 21h ;Ring answer flag fsendtimer bit 22h ;Flagto send after 4 seconds f_inuseofftiming  bit 23h ;Flag shows timer isrunning to check ; 2 sec with in use lamp off funlocktimer bit 24h ;Flagto unlock after 4 seconds fdtone bit 25h ;Flag shows DT is onfdecoder_busy bit 26h ;Flag shows dtmf decoder has not ; cleared yetfbellsound bit 27h ;Flags ringer is sounding px1_temp DATA 25h;Input/output buffer for port px1 - ; contains these bits: mitelq1  bit28h ;From dtmf decoder mitelq2  bit 29h ;From dtmf decoder mitelq3  bit2ah ;From dtmf decoder mitelq4  bit 2bh ;From dtmf decoder power_holdbit 2ch ;Maintain power after power failure to ; turn off TRU spare1 bit2dh ;Spare I/O pin spare2 bit 2eh ;Spare I/O pin no_ring bit 2fh ;SpareI/O pin px2_temp DATA 26h ;I/O buffer for port px2 (30h-37h)loopswitch_(—) bit 30h ;Low closes loop ring_(—) bit 31h ;Low turns onring ps mute bit 32h ;Mute rx audio roh_boost bit 33h ;Increase gain forroh tone sw_sendtimer bit 34h ;Jumper in gives 4 sec send optionsw_dialtone bit 35h ;Jumper in = diff dial tone for roam ; out meansmaintenance module sw_gndstart bit 36h ;IN = loop start, OUT =groundstart sw_data  bit 37h ;Jumper in prevents, out allows digit ;data to TRU after send (to allow ; features from cell. switch)lamps_temp DATA 27h ;Contains these bits: ;free bit 38h ;Not reallylamps -- these store the ;free bit 39h ; current status of indicators;free bit 3ah ;free bit 3bh roamlamp bit 3ch noservlamp bit 3dh locklampbit 3eh inuselamp bit 3fh flags3 DATA 28h ;More flags- this bytecontains the ; following individually addressable ; bits frohtimeout bit40h ;Set when rohtone has been on 1 minute fcall bit 41h ;Set when callincoming, clear if not f_one_sec bit 42h ;Set when off hook for one secso ; change in inuse lamp won't cause ; remote hangup if phone taken off; hook quickly after local hangup. roh_on bit 43h ;Turns rohtone on &off fspec1 bit 44h ;Flag for special use with specific TRU ; processedin update_displays every ; 71.1 ms, calls spec1 fspec2 bit 45h ;Flag forspecial use with specific TRU ; processed in on- or off-hook timers ;every 277.8 usec, calls spec2 fremote_hup bit 46h ;Indicates remote hupfor 700 msec ; delay flocktimer bit 47h ;Flag to lock after 2 seconds;**************************************************************** ; ;Implemented TRU tasks ;;**************************************************************** f_cmdsDATA 29h ; Optional TRU specific task numbers ; TRU tasks are for callsfrom the main into the TRU module. ; Task 1: ; a.) Power loss check forNEC 3700 (see nae01) ; b.) Send change in hook switch status to OKI andalso send initial CLR ; for the Motorola (see oee02 and mae04) ; c.)Call rdbus routine to read indicator status in the Audiovox TRUs ; (seetae01 and tbe01) ; d.) Monitor for silent alert mode in AudiovoxCTX-3100A and set ; silent alert mode if necessary (see tbe01) ; ; Task2: ; a.) Dual NAM switching for NEC 3700 (see nae01) ; ; Task 3: ; a.)Power loss check for NEC 3700 (see nae01) ; b.) Send any change in hookswitch status to OKI and Motorola ; (see mae04 and oee02) ; c.) Callrdbus routine to read indicator status in the Audiovox ; TRUs (see tae01and tbe01) ; d.) Monitor for silent alert mode in Audiovox CTX-3100A andset ; silent alert mode if necessary (see tbe01) ; Task 4: ; a.) Callrdbus routine to read indicator status in the Audiovox ; TRUs (see tae01and tbe01) ; b.) Monitor for silent alert mode in Audiovox CTX-3100A andset ; silent alert mode if necessary (see tbe01);**************************************************************** ; ;The Ram area 2Ah thru 2dh is reserved for use by the TRU modules ;either as DATA bytes or individual BIT variables. ;;****************************************************************;TRU_bits1 data 2ah ;Bit 50h through 57h ;TRU_bits2 data 2bh ;Bit 58hthrough 5fh ;TRU_bits3 data 2ch ;Bit 60h through 67h ;TRU_bits4 data 2dh;Bit 68h through 6fh ; ; Used for the maintanence board  ! check the truroutine ! ; io_m_b data 2eh ;Bit 70h through 77h td0 bit 70h td1 bit 71htd2 bit 72h td3 bit 73h dtmf_out bit 74h enable_test bit 75h enable_tonebit 76h enable_tone_in bit 77h io_m_c data 2fh ;Bit 78h through 7fhext_led bit 78h enable_special bit 79h enable_busy bit 7ah enable_16hbit 7bh conn_loop bit 7ch;**************************************************************** ; ;More internal (BYTE addressable) ram variables ;;****************************************************************looptest_timer data 30h ; Delays looptest for 2ms after loopslooptest_timer2 data 31h ; closes to allow SLIC to respond display_delaydata 32h ; Delays display update to every 71.1 dsp_ptr data 33h ;Handset LCD display buffer pointer msg_ptr data 34h ; TRU message bufferpointer;**************************************************************** ; ;The following bytes are reserved for the TRU modules for use ; only asDATA bytes (not BIT addressable) ;;****************************************************************;TRU_byte0 data 38h ;TRU_byte1 data 39h ;TRU_byte2 data 3ah ;TRU_byte3data 3bh ;TRU_byte4 data 3ch ;TRU_byte5 data 3dh ;TRU_byte6 data 3eh;TRU_byte7 data 3fh ; Stack occupies bytes 40h-5fh;**************************************************************** ; ;Digits dialed are stored in bytes from 60h to 7fh permitting ; a totalof 32, including the SND code used as a terminator. ;;**************************************************************** prefixdata 60h ; Only [0] or [1] are valid, else FFh first_digit data 61h ;First three locations in the digit second_digit data 62h ; buffer(emergency numbers, area code third_digit data 63h ; start of 7digitnumber, etc.);**************************************************************** ; ;8051 port1 & port3 bit definitions, (common to all units) ;;****************************************************************io_select bit p1.2 dt_pwm bit p1.4 ; Dial tone pwm twenty_hz_pwm bitp1.5 ; 20hz pwm for ringer ;power_fail_(—) bit p1.6 ; Input , 0 = powersupply is failing lc_(—) bit p3.2 ; Loop current sense, (ExtInt0)ring_ground_(—) bit p3.4 ; Input: shows ground on ring lead ;strobe bitp3.5 ; Input: digit ready from DTMF decoder a0 bit p1.6 a1 bit p3.5;**************************************************************** ; ;Power up entry point, and interrupt routine vectors: ;;**************************************************************** org0000h ; Reset vector jmp init org 0003h ; ExtInt0 service vector jmpoffhook_edge ; Off hook, flash, & pulse dial db 0ffh,0ffh,0ffh,0ffh,0ffh; Fill for Eprom and emulator org 000bh ; Timer0 (tl0) svc vector jmponhook_timer ; To keep track of how long on hook db0ffh,0ffh,0ffh,0ffh,0ffh org 0013h ; ExtInt1 service vector jmpint1_service ; Usually to read data from TRU db 0ffh,0ffh,0ffh,0ffh,0ffhorg 001bh ; Timer1 (th0) svc vector jmp offhook_timer ; For periodictimer ints db 0ffh,0ffh,0ffh,0ffh,0ffh org 0023h ; Serial port svcvector jmp ser_port_service ; Usually to read data from TRU db0ffh,0ffh,0ffh,0ffh,0ffh org 002bh ; Timer2/ext2 svc vector jmptimer2_service db 0ffh,0ffh,0ffh,0ffh,0ffh org 0033h ; PCA servicevector jmp pca_service ; For pulse width modulators db ‘ (c) CopyrightCodecom ’ db ‘1992. ’ $include(main.msg) $include(tru.msg) init:%set(intmask,0) ; Normally two interrupt levels unless ; intmask set toother than zero in ; TRU section (TAE01.ASM: Audiovox) mov sp,#3fh ;Stack starts at 40h clr rs0 ; Select register bank 0 clr rs1 ; Ditto mova,#0 ; To fill ram with zero mov r0,#0 ; Point to first ram fill_ram:mov @r0,a ; One location at a time inc r0 ; Point to next location cjner0,#0,fill_ram ; Fill up end of ram (FFh) clr p1.2 mov r1,#main_flag mov@r1,#0 ; read second flag inc r1 mov @r1,#0 inc r1 mov @r1,#0 inc r1 mov@r1,#0 call reset_io_m ; reset the maintanence board mov io_m_b,#0 ;disable module call write_io_m_b mov io_m_c,#0 ; disable module callwrite_io_m_c call reset_io ; reset i/o expanded to #13 mov p2,#0f8h ;Set p2 to drive port expander mov px1_temp,#11111111b ; Initializeincluding power_hold on call write px1 mov px2_temp,#11110011b ;Initialize: loopsw open, not ringing call write_px2 call read_px2 ; Readoption switches mov tmod,#00000011b ; Timer0 is two timers, and timer1can ; be baud rate gen mov ip,#01001010b ; Set int priorities movie,#11001011b ; Enable PCA, Timer1, Timer0, Ext0 ; Tmr/Ext2,SerPort,Ext1by TRU inits setb it0 ; ExtInt0 is edge trig'd setb it1 ; ExtInt1 isedge trig'd mov cmod,#80h ; Counter off during idle, clock/12 mov ch,#0; Load high counter mov cl,#0 ; Load low counter mov ccap01,#0ffh ; Lowbyte for timer comparator mov ccap0h,#0 ; High byte for timer comparatormov ccapm0,#049h ; PCA0: software timer mov ccapm1,#0 ; PCA1: (DialTone) off for now mov ccapm2,#0 ; PCA2 (20 hz pwm) is off now clr tr1 ;Off-hook int timer not running yet clr tr0 ; On-hook timer not running ;Initialize byte variables mov time_on1,#0 ; Initialize onhook interrupttimers mov time_on2,#0 mov time_off1,#0 ; Initialize offhook interrupttimers mov time_off2,#0 mov time_off3,#0 mov flags,#0 ; Clear all theflags mov flags2,#0 ; Clear all the flags mov flags3,#0 ; Clear all theflags mov inds,#0ffh ; Initial vals mov indasc,#0ffh ; Initial vals movpulse_digit,#0 ; 0 = no pulse digit(s) available now mov f_cmds,#0 ; 0 =no TRU task commanded ; Initialize bit variables clr test_enable clrtest_end clr error_flag clr  return_ring setb fonhook ; 1 = Assume phoneon hook on power clr f_init ; 0 = TRU init not completed yet clrfremote_hup clr fcall ; 0 = No incoming call (ALERT) yet call clr_dsp ;Clear handset LCD display buffer call clr_msg ; Clear TRU messagesbuffer call specific_inits ; Do TRU specific initializations movccap4l,#0ffh ; Low byte for watchdog match word mov ccap4h,#0ffh ; Highbyte for watchdog match word mov ccapm4,#48h ; PCA4: Enable comparator &interrupt orl cmod,#40h ; Enable watchdog timer setb cr ; Start PCAcounter setb tr0 ; Start on hook timer ; Wait 2.55 second for TRU towake up. Clear the dialed digits location, ; then point R0 to digitsbuffer start (60h), and clear R2 (dialed digits ; count). time_wakeup:call watchdog mov a,time_on2 ; Get elapsed time cjne a,#255,time_wakeup; Wait here 2.55 sec for tru wakeup mov c,sw_gndstart ; Check GS-LSjumper, 0=LS 1=GS mov loopswitch_,c ; Save start mode clr no_ring callwrite_px2 jmp start $include(tru.asm) ; TRU module here, so INTMASK canbe ; evaluated at assembly time;**************************************************************** ; ;Start, and Re-Entry point following hang up ;;**************************************************************** start:mov r0,#60h ; Point to digit buffer start mov a,#0ffh ; Fill withnon-digits clr_digbuf: mov @r0,a ; One location at a time inc r0 ; Pointto next location cjne r0,#80h,clr_digbuf ; Through 7fh mov r0,#60h ;Point to buffer start mov r2,#0 ; Initialize digit count setb f_start ;1 = enable hook switch deglitching clr ie0 ; Clear offhook int just incase setb ex0 ; Enable offhook int in case disabled ; Endless loop untilwe either detect an incoming call or we lift ; the handset to dial out.hookchk: call watchdog jb test_enable,do_test ; if auto test activatedmov f_cmds,#1 ; Load command ID ; call trucmd ; Do task1 for TRU, ifneeded jb fhook,first1 ; Brif off hook jnb fanswer,hookchk ; Back if noincoming ring detected jmp ring_answer ; Answer ring, we went off hookduring ; an ALERT (incoming call) state! first1: jmp first do_test: movr1,#main_flag_error mov @r1,#0 ; set the tone error busy or 1000 hz movr1,#main1_flag_error mov @r1,#0 ; set the tone error busy or 1000 hz clrtest end clr error_flag clr error_flag mov r1,#main_flag mov a,@r1 ;read first flag ani a,#00000001b ; check if hook was done callstart_hook_test ; hook test test_hook: jb error_flag,rou_error calldial_test ; dial test test_dial: jb error flag,rou_error call start_dtmf; dtmf test test_dtmf: jb error flag,rou_error call start_ring_test ;ring test test_ring: jb error_flag,rou_error call start_ring_ans_test ;ring answer test test_ring_a: jb error_flag,rou_error call make_call ;call test jb error_flag,rou_error jmp until_fin_tim ; exit withouterrors rou_error: call error_acc ; load error variable ; jmp wait_enduntil_fin_tim: setb test_end clr tr0 mov time_on2,#0 ;Every 10 msecwhile on hook mov time_on1,#0 ;Reset for next 36 mov test_min,#0 ; 10msec x 255 = .255 sec setb tr0 wait_end: call watchdog ; be here until 1min expire mov a,test_min cjne a,#23,wait_end ; 255 x 236 = 60.18 callfin_self ; return to normal jmp hookchk ; return to normal;************************************************ ;start_hook_test-start hook test ;************************************************start_hook_test: mov r1,#main_flag ; read main flag mov a,@r1 orla,#00000001b mov @r1,a ; set the off-hook flag setb enable_test;disconnect the telephone clr conn_loop call write_io_m_b ; and connectmodule call reset_io_m ; reset the maintanence board call write_io_m_bcall write_io_m_c clr loopswitch_(—) ;Other side has disconnected callwrite_px2 test_hup: setb fremote_hup call hup mov lamps_temp,#0 callwrite_io_c ; update the LEDS mov r6,#10 nose: push 6 mov r6,#0ffh ;delay module loop_m: mov r7,#0ffh djnz r7,$ call watchdog djnz r6,loop_mmov r6,#0ffh ; delay module loop_ma: mov r7,#0ffh djnz r7,$ callwatchdog djnz r6,loop_ma mov r6,#0ffh ; delay module loop_mb: movr7,#0ffh djnz r7,$ call watchdog djnz r6,loop_mb mov r6,#0ffh ; delaymodule loop_mc: mov r7,#0ffh djnz r7,$ call watchdog djnz r6,loop_mc pop6 djnz r6,nose test_hup2: clr fanswer clr fhook ; Clear the flag jnb fhook,not_hook_det ; no off-hook det. ok ; off-hook detected error jmphook_error not_hook_det: ; test off-hook setb fonhook setb conn_loop ;present off hook to the call write_io_m_c ; interface mov r6,#0ffh ;delay off hook loop_m_off: mov r7,#0ffh djnz r7,$ call watchdog djnzr6,loop_m_off mov r6,#0ffh ; delay off hook loop_m_off2: mov r7,#0ffhdjnz r7,$ call watchdog djnz r6,loop_in_off2 mov r6,#0ffh ; delay offhook loop_m_off3: mov r7,#0ffh djnz r7,$ call watchdog djnzr6,loop_m_off3 mov r6,#0ffh ; delay off hook loop_m_off4: mov r7,#0ffhdjnz r7,$ call watchdog djnz r6,loop_m_off4 mov r6,#0ffh ; delay offhook loop_m_off5: mov r7,#0ffh djnz r7,$ call watchdog djnzr6,loop_m_off5 test_fhook: jb fhook,detected_hook ; if hook detected ok; not off-hook det error jmp hook_error detected_hook: clr ex0 ; Disableoffhook int til dial tone to ; prevent dialing due to bounce clrhookswout ; Show off-hook to TRU setb hookswout_(—) ; Ditto clr fhook ;Clear the flag dt_delay1: call watchdog jnb lc_,still_off_hook jmphook_error ; fail off hook still_off_hook: jb f_start,dt_delay1 ; Willbe set after 500 ms deglitching clr ie0 ; Clear offhook int flag just incase setb ex0 setb fdtone ; 1 = the Dial Tone is on call dtone ; Enablethe Dial Tone ret ; exit from hook test hook_error: movr1,#main_flag_error mov @r1,#1 ; hook slic error setb error_flag ret;************************************************* ;dial_test check thedial tone ;************************************************* dial_test:mov r1,#main_flag ; read main flag mov a,@r1 orl a,#00000010b mov @r1,a; set the dial tone flag mov r6,#0ffh ; delay off hook delay_dial: movr7,#0ffh djnz r7,$ call watchdog djnz r6,delay_dial mov r6,#0ffh ; delayoff hook delay_dial2: mov r7,#0ffh djnz r7,$ call watchdog djnzr6,delay_dial2  clr tr1 ; wait 711 msec to detect dial mov time_off1,#0mov time_off2,#0 setb tr1 verify_dial: call read_io_m_a ; check dialtone anl a,#00000001b cjne a,#00000001b,dial_ok ; if 0 dial ok callwatchdog mov a,time_off2 ; dial is not detected cjne a,#10,verify_dial ;wait 711 msecs if busy not detected ; dial tone fail movr1,#main_flag_error mov @r1,#3 ; dial error setb error_flag ret dial_ok:; no error ret ;*************************************************;start_dtmf - start the dtmf;************************************************* start_dtmf: clrfdtone mov ccapm1,#0 anl io_m_b,#0f0h orl io_m_b,#cero ; send 0 callsend_dtmf call delay_dtmf call disable_dtmf call delay_dtmf callget_test test_cero: cjne a,#0h,dtmf_error_flag ; verify 0 anlio_m_b,#0f0h orl io_m_b,#uno ; send 1 call send_dtmf call delay_dtmfcall disable_dtmf call delay_dtmf call get_test test_1: cjnea,#1h,dtmf_error_flag ; verify 1 anl io_m_b,#0f0h orl io_m_b,#dos ; send2 call send_dtmf call delay_dtmf call disable_dtmf call delay_dtmf callget_test test_2: cjne a,#2h,dtmf_error_flag ; verify 2 anl io_m_b,#0f0horl io_m_b,#tres ; send 3 call send_dtmf call delay_dtmf calldisable_dtmf call delay_dtmf call get_test test_3: cjnea,#3h,dtmf_error_flag ; verify 3 anl io_m_b,#0f0h orl io_m_b,#cuatro ;send 4 call send_dtmf call delay_dtmf call disable_dtmf call delay_dtmfcall get_test test_4: cjne a,#4h,dtmf_error_flag ; verify 4 jmp go_to_5dtmf_error_flag: jmp error_dtmf go_to_5: anl io_m_b,#0f0h orlio_m_b,#cinco ; send 5 call send_dtmf call delay_dtmf call disable_dtmfcall delay_dtmf call get_test test_5: cjne a,#5h,dtmf_error_flag ;verify 5 anl io_m_b,#0f0h orl io_m_b,#seis ; send 6 call send_dtmf calldelay_dtmf call disable_dtmf call delay_dtmf call get_test test_6: cjnea,#6h,dtmf_error_flag ; verify 6 anl io_m_b,#0f0h orl io_m_b,#siete ;send 7 call send_dtmf call delay_dtmf call disable_dtmf call delay_dtmfcall get_test test_7: cjne a,#7h,dtmf_error_flag ; verify 7 anlio_m_b,#0f0h orl io_m_b,#ocho ; send 8 call send_dtmf call delay_dtmfcall disable_dtmf call delay_dtmf call get_test test_8: cjnea,#8h,dtmf_error_flag1 ; verify 8 anl io_m_b,#0f0h orl io_m_b,#nueve ;send 9 call send_dtmf call delay_dtmf call disable_dtmf call delay_dtmfcall get_test test_9: cjne a,#9h,dtmf_error_flag1 ; verify 9 anlio_m_b,#0f0h orl io_m_b,#05h ; send a call send_dtmf call delay_dtmfcall disable_dtmf call delay_dtmf call get_test test_a: cjnea,#0ah,dtmf_error_flag1 ; receive a anl io_m_b,#0f0h orl io_m_b,#0dh ;es b call send_dtmf call delay_dtmf call disable_dtmf call delay_dtmfcall get_test test_b: cjne a,#0bh,dtmf_error_flag1 jmp go_to_cdtmf_error_flag1: jmp error_dtmf go_to_c: anl io_m_b,#0f0h orlio_m_b,#03h ; es 3 call send_dtmf call delay_dtmf call disable_dtmf calldelay_dtmf call get_test test_c: cjne a,#0ch,dtmf_error_flag1 anlio_m_b,#0f0h orl io_m_b,#0bh ; es d call send_dtmf call delay_dtmf calldisable_dtmf call delay_dtmf call get_test test_d: cjnea,#0dh,dtmf_error_flag1 anl io_m_b,#0f0h orl io_m_b,#07h ; es 7 callsend_dtmf call delay_dtmf call disable_dtmf call delay_dtmf callget_test test_e: cjne a,#0eh,dtmf_error_flag1 anl io_m_b,#0f0h orlio_m_b,#0fh ; es f call send_dtmf call delay_dtmf call disable_dtmf calldelay_dtmf call get_test test_f: cjne a,#0fh,dtmf_error_flag1 ret ; exitwithout error_dtmf: mov r1,#main_flag_error mov @r1,#4 ; dtmf error setberror_flag ret ;*************************************************;start_ring_test - start the ring test;************************************************* start_ring_test: ;init the ringing  mov r1,#main_flag ; read main flag mov a,@r1 orla,#00001000b mov @r1,a ; set the ring test flag clr ring_second clrconn_loop ; present an on hook call write_io_m_c setb fremote_hup callhup mov r6,#6 loop_ring_wait: push 6 mov r6,#0ffh ; delay moduleloop_mbb: mov r7,#0ffh djnz r7,$ call watchdog djnz r6,loop_mbb movr6,#0ffh ; delay module loop_mcc: mov r7,#0ffh djnz r7,$ call watchdogdjnz r6,loop_mcc pop 6 djnz r6,loop_ring_wait ; incoming call clr ap1 ;init an incoming cal jb lc_,loop_ring_off jmp ring_flag loop_ring_off: ;loop here until ring start or clr tr0 ; 2 sec expire mov time_on2,#0 movtime_on1,#0 setb tr0 wait_2_sec: call watchdog jnb fanswer,not_answerjmp ring_flag ; answer occurred error not_answer: call read_io_m_a anla,#00000100b cjne a,#00000100b,ring_starts ; if 0 ring started mova,time_on2 ; check if 2 second expire cjne a,#200,wait_2_sec ; wait 2sec to stop the dtmf jmp ring_flag ; 2 sec expire, error ring_starts:mov r6,#0ffh ; delay module loop_mbbc: mov r7,#0ffh djnz r7,$ callwatchdog djnz r6,loop_mbbc mov r6,#0ffh ; delay module loop_mccd: movr7,#0ffh djnz r7,$ call watchdog djnz r6,loop_mccd ring_start: ; checkfor ring 1.3s continuity clr tr0 mov time_on2,#0 mov time_on1,#0 setbtr0 wait_130 msec: ; check ring during 1.3 sec call watchdog jnbfanswer,not_answer1 jmp ring_flag ; answer occured error not_answer1:call read_io_m_a test_130: anl a,#00000100b ; should be low during 1.3sec cjne a,#00000100b,ring_expire jmp ring_flag ; ring fail within 1.3sec ring_expire: mov a,time_on2 cjne a,#90,wait_130 msec ; wait 130 msecwait_250 msec: ; the ring should stop after 1.5s call watchdog ; but wewill wait 2.5s to check if call read_io_m_a ; it stop test_250: anla,#00000100b ; should be low during .2 sec more cjnea,#00000100b,ring_not_expire test_stop: jmp ring_stop_(—) ; ring stopbefore 2.5s ring_not_expire: mov a,time_on2 ; after 1.5 sec it should behigh cjne a,#250,wait_250 msec ; wait 250 msec test_flag: jmp ring_flag; ring did not stop within 2.5s error ring_stop : ; wait 2.55s clr tr0mov time_on2,#0 mov time_on1,#0 setb tr0 wait_2_seca: call watchdog jnbfanswer,not_answer2 jmp ring_flag ; answer occurred error not_answer2:mov a,time_on2 cjne a,#255;wait_2_seca ; wait 2.55s to stop the dtmf ;second loop jb ring second,ring_stop1 setb ring_second ; check ring 2times jmp loop_ring_off ; start again ring_flag: setb ap1 ; clearincoming call mov r1,#main_flag_error mov @r1,#5 ; ring error setberror_flag ring_stop1: test_timbre: ret ; exit without error;*************************************************;start_ring_ans_test - answer the ring;************************************************* start_ring_ans_test:; init the ringing  mov r1,#main_flag ; read main flag mov a,@r1 orla,#00010000b mov @r1,a ; set the ring test flag loop_ring_off2: ; waithere until ring start again clr tr0 mov time_on2,#0 mov time_on1,#0 setbtr0 wait_2_sec2: call watchdog jnb fanswer,not_answera ; if ring answerexit jmp ans_flag not_answera: call read_io_m_a anl a,#00000100b cjnea,#00000100b,ring_present ; if cero ring present mov a,time_on2 cjnea,#200,wait_2_sec2 ; wait 2 sec to stop jmp ans_flag ; 2 sec expirering_present: setb conn_loop ; answer the ring call write_io_m_c movr7,#0ffh ; delay to allow time to set fanswer wait_ans: mov r6,#0ffhdjnz r6,$ call watchdog djnz r7,wait_ans mov r7,#0ffh wait_ansa: movr6,#0ffh djnz r6,$ call watchdog djnz r7,wait_ansa test_ans: jbfanswer,ok_ring ; if answer, ring ans ok jmp ans_flag ; didn't answererror ans_flag: mov r1,#main_flag_error mov @r1,#6 ; ring error setberror_flag setb ap1 clr fanswer ret ok_ring: ; exit without errortimbre: clr fanswer setb ap1 ; clear incoming call ret;************************************************ ;make call - make acall to test the radio ;***************************************make_call:  mov r1,#main1_flag ; read main1 flag mov a,@r1 orla,#00000001b mov @r1,a ; set the call test flag test_mute: jnbpower_,power_is_ok ; if radio ok line should be low(0) movr1,#main1_flag_error mov @r1,#1 ; set the power line error setberror_flag jmp pre_onhook power_is_ok: mov a,#func ; function to readthe phone number call wrbus mov a,#7 call wrbus call clr_dsp mov a,#starcall wrbus mov r7,#0ffh ; delay to allow time to send numb wait_min: ;to interface mov r6,#0ffh djnz r6,$ call watchdog djnz r7,wait_min movr7,#0ffh wait_mina: mov r6,#0ffh djnz r6,$ call watchdog djnzr7,wait_mina mov a,#9h call wrbus mov a,#0ah call wrbus ; generate acall to its phone number  mov a,#dspbuf_start ; Get current pointer adda,#3 mov r1,a mov a,@r1 ; Read msg in buffer anl a,#0fh call wrbus incr1 mov a,@r1 ; Read msg in buffer anl a,#0fh call wrbus inc r1 mov a,@r1; Read msg in buffer anl a,#0fh call wrbus inc r1 TnoV a,@r1 ; Read msgin buffer anl a,#0fh call wrbus inc r1 mov a,@r1 ; Read msg in bufferanl a,#0fh call wrbus inc r1 mov a,@r1 ; Read msg in buffer anl a,#0fhcall wrbus inc r1 mov a,@r1 ; Read msg in buffer anl a,#0fh call wrbussetb fsend ;Set send flag mov a,#send ; make a call call wrbus setbenable_special ; enable Q4 call write_to_m_c test_mute1: clr mute ; donot mute call write_px2 clr tr1 ; delay to check inuse mov time_off1,#0mov time_off2,#0 setb tr1 delay_call: mov a,time_off2 call watchdog cjnea,#80,delay_call ; wait 1 ?seconds test_mute2: ; test busy tone clr tr1mov time_off1,#0 mov time_off2,#0 mov time_off3,#0 setb tr1cont_waiting: jnb inuse,still_inuse mov r1,#main1_flag_error mov @r1,#4; set the inuse error jmp call_error ; if iube disapear set errorstill_inuse: call read_io_m_a ; check dial tone anl a,#00000001b cjnea,#00000001b,busy ok ; if 0 busy ok call read_io_m_a ; check dial toneanl a,#00001000b cjne a,#00001000b,t1000 z ; if 1000khz busy ok mova,time_off3 ; busy is not detected call watchdog cjne a,#1h,cont_waiting; wait 18.2 secs if busy not detected mov r1,#main1_flag_error mov@r1,#3 ; set the tone error busy or 1000hz call_error: mov a,#end1 ;make a call call wrbus setb error_flag ; present and on hook jmppre_onhook t1000hz: ; 950 hz-1100 hz tone detected busy_ok: ; 400 hz-620hz tone detected mov a,#end1 ; make a call call wrbus pre_onhook: clrconn_loop ; present and on-hook call write_io_m_b ; and connect modulecall hup ret ;************************************************ ;erroracc - set the error code;************************************************ error_acc: movr1,#main_flag_error mov a,@r1 cjne a,#1,check_hook_ring movr1,#error_code ; hook slic error mov @r1,#1 jmp exit_errorcheck_hook_ring: cjne a,#2,check_dial_flag mov r1,#error_code ; hookring error mov @r1,#2 check_dial_flag: cjne a,#3,check_dtmf_flag movr1,#error_code ; dial error mov @r1,#3 jmp exit_error check_dtmf_flag:cjne a,#4,check_ring_flag mov r1,#error_code ; dtmf error mov @r1,#4 jmpexit_error check_ring_flag: cjne a,#5,check_ring_ans_flag movr1,#error_code ; ring detection error mov @r1,#5 jmp exit_errorcheck_ring_ans_flag: cjne a,#6,check_power_flag mov r1,#error_code ;ring answer error mov @r1,#6 jmp exit_error check_power_flag: ; checkcalls flag mov r1,#main1_flag_error mov a,@r1 cjne a,#1,check_call_testmov r1,#error_code ; power radio error mov @r1,#7 jmp exit_errorcheck_call_test: cjne a,#2,check_busy_test mov r1,#error_code ; xxxerror mov @r1,#8 jmp exit_error check_busy_test: cjnea,#3,check_inuse_test mov r1,#error_code ; busy tone error mov @r1,#9jmp exit_error check_inuse_test: cjne a,#4,check_1000_test movr1,#error_code ; inuse error mov @r1,#10 jmp exit_error check_1000_test:cjne a,#5,exit_error mov r1,#error_code ; 1000hz tone error mov @r1,#11jmp exit_error exit_error: ret;************************************************ ;fin_self - return tonormal ;************************************************ fin_self: clrconn_loop ; present on hook to the call write_io_m_c ; interface callhup clr enable_test ; connect the the telephone call write_io_m_b ; anddisconnect module clr test_enable ; init maint test clr test_end ;finish test clr error_flag ; error flag jnb error_flag,turn_on_led clrext_led ; turn off external led while testing call write_io_m_c ; turnon/off the external led call loop_bad turn_on_led: setb ext_led ; turnoff external led while testing call write_io_m_c ; turn on/off theexternal led call loop_bad clr ext_led ; turn off external led whiletesting call write_io_m_c ; turn on/off the external led call loop_badsetb ext_led ; turn off external led while testing call write_io_m_c ;turn on/off the external led call loop_bad clr ext_led ; turn offexternal led while testing call write_io_m_c ; turn on/off the externalled call loop_bad setb ext_led ; turn off external led while testingcall write_io_m_c ; turn on/off the external led call loop_bad test_4on:clr ext_led ; turn off external led while testing call write_io_m_c ;turn on/off the external led call loop_bad ret loop_bad: mov r7,#0ffh ;delay to allow time to set fanswer wait_emb: mov r6,#0ffh djnz r6,$ callwatchdog djnz r7,wait_emb xnov r7,#0ffh wait_emba: mov r6,#0ffh djnzr6,$ call watchdog djnz r7,wait_emba ret ; Get here when we lifted thehandset to dial. first: call clr_msg ; Clear previous TRU messages clrex0 ; Disable offhook int til dial tone to ; prevent dialing due tobounce clr hookswout ; Show off-hook to TRU setb hookswout_(—) ; Dittoclr fhook ; Clear the flag dt_delay: call watchdog mov f_cmds,#4;NOTE:INTO & TIMER0 have been suspended ; at this point - do not use anytru ; specific function which relies on ; these interrupts. call trucmd; Perform any TRU specific commands jb f_start,dt_delay ; Will be setafter 500ms deglitching clr ie0 ; Clear offhook int flag just in casetest_lc: jnb lc_,alert check ; Brif still off hook after 500ms test_lc1:call hup ; Phone put back on hook < 500 msec jmp start alert_check: setbex0 ; Reenable offhook int (DT is on now) jb inuse,make_dt ; Brif notINUSE, we are ready to dial jmp wait ; If already INUSE probablyanswered ; an incoming call by coming offhook ; We are off hook for500ms lets generate a dial tone. make_dt: setb fdtone ; 1 = the DialTone is on call dtone ; Enable the Dial Tone call get ; Get a characteror exit if hang up jb inuse,check_prefix clr fdtone mov ccapm1,#0 jmpwait check_prefix: jb lock,prefix_0 ; Brif TRU isn't locked cjnea,#pound,nosend ; Brif locked, only # (unlock) is valid prefix_0: cjnea,#zero,prefix_1 ; Brif not a [0] jmp store_it ; Go to store [0] asprefix prefix_1: cjne a,#1,no prefix ; Brif not a [1] either jmpstore_it ; Go to store [1] as prefix no_prefix: inc r0 ; Leave prefixslot unchanged. (FFh) inc r2 ; But up the digit count ; Store currentdigit and get another one until time to send them out. store_it: cjner0,#7fh,do_store_it ; Brif digit buffer is not full yet jmp check_number; Brif buffer is full, w/o storing do_store_it: mov @r0,a ; Store thedigit inc r0 ; Advance digit buffer pointer ; Check the entered digitsand analyze them for valid sequences. check_number: clr fsendtimer ;Assure it is off mov a,first_digit ; point to 1st digit slot cjnea,#0ffh,check_one ; Brif first digit entered jmp check_send ; Else checkif time to send check_one: cjne a,#pound,check_send ; Brif not [#](lock, unlock, etc.) mov a,second_digit ; point to 2nd digit if first is[#] cjne a,#0ffh,check_two ; Brif second digit entered jmp check_send ;Else check if time to send check_two: cjne a,#pound,check_main ; Brifnot [#][#] (lock or unlock) mov a,third_digit ; Two #'s might be lock orunlock cjne a,#pound,check_unlock ; Three #'s mean locking jnblock,nosend ; Do not lock if already locked jmp lock_it ; [#][#][#]means locking check_nam: cjne a,#star,check_send ; Abort if not [#][*]sequence mov a,third_digit ; Else get the third digit also cjnea,#0ffh,check_main1 ; Brif third digit entered jmp check_send ; Elsecheck if time to send check_nam1: mov f_cmds,#2 ; Load function number,then go to call trucmd ; Switch to alternate NAM ; Abort on invalidnumber (dial) sequences. nosend: clr funlocktimer ; Turn off unlocktimer # sign set it setb fonhook ; As if on hook setb ie0 ; Go toExtInt0 service jmp start ; just like off hook again check_unlock: cjnea,#0ffh,unlocking_it ; Brif any digit was dialed after # jmp check_send; Else go to check if time to send unlocking_it: setb funlocktimer ;Will send after 2 sec w/o SND code jmp get_next ; to avoid unlock codebeing sent l ; a valid number ; Get here if the digit sequence entereddid not qualify as any ; of the special function (lock, unlock, dualNAM, etc) options. check_send: jb sw_sendtimer,check_intl ; Brif sw7=1,interntnl calls enabled setb fsendtimer ; Enable sending after 4 sec ifsw7=0 jmp get_next ; And back for next digit check_intl: mov a,prefix ;Test for prefix in acc cjne a,#zero,check_op ; Brif not [0] mova,first_digit ; Else get the first real digit cjne a,#1,check_op ; Brifnot [1], may be operator call setb fsendtimer ; International call!Starts with 01-. jmp get_next ; Back for more, only timer sends now!check_op: mov a,prefix ; Get prefix digit again cjne a,#10,check_service; Brif prefix is not 0 cjne r2,#0,check_service ; Brif digit(s) alsowere dialed setb fsendtimer ; Else it may be a call to operatorcheck_service: cjne r2,#3,check_distance ; Brif not 3 digits mova,second_digit ; Else if emergency, inform. etc. cjnea,#1,check_distance ; Brif second digit is 1 mov a,third_digit ; Getthird digit cjne a,#1,check_distance ; Brif third digit is not 1 jmpsend_it ; It must be an emerg., send it check_distance: cjner2,#10,check_local ; Ten digit was dialed? jmp send_it ; Send on 10thunless international check_local: cjne r2,#7,get_next ; Brif less thenseven digit was dialed setb fsendtimer ; Prepare to send in 4 sec mova,second_digit ; Get 2nd digit subb a,#1 ; Is it a #1 ? jz get_next ;Brif so, could be area code, or local mov a,second_digit ; Get 2nd digitagain subb a,#10 ; Is it a 0 ? jz get_next ; Brif so, maybe area code,maybe local clr fsendtimer ; Don't want another, send 5sec later jmpsend_it get_next: inc r2 call get ;Get a new digit jmp store_it ;Do allthe checks with the new digit;************************************************* ; ; Dialing done,send the number out ; ;************************************************; Check if the TRU is locked, and abort if no unlock code was entered.send_it: jb lock,send1 ; Brif TRU is not locked locked: mova,third_digit ; Get third digit cjne a,#0ffh,send1 ; Brif any digitentered jmp nosend ; Don't send if no unlock code entered ; Send dialeddigit. send1: setb mute ;Mute rx audio call write_px2 mov @r0,#send ;Putsend at end of digits mov a,#clear ;Clear code call wrbus ;Put clearcode first to clear any ; digits from TRU memory in case ; handset hasentered some first mov r0,#60h ;Reset pointer to show storage mov a,@r0;Put prefix in acc cjne a,#0ffh,out inc r0 ;Skip prefix if it is ff out:mov a,@r0 call wrbus ;Write to the bus jnb fhang,send_ok test_lc2: callhup ;Abort dump if hangup jmp start send_ok: inc r0 cjne a,#send,out;Keep on til SND code setb fsend ;Set send flag clr mute ;Unmute rxaudio call write_px2 ; Dialing done, conditionally echo digit to TRU,then wait for ; further possible digits (extension, etc.), or let theinterrupts ; take over the show. wait: call get ;Check for any digitsfrom MJ phone jnb sw_data,wait ;Discard if data after snd is disabledcall wrbus ;Else send data to TRU jmp wait ;Loop til we or other partyhangs up ;************************************************* ; ; DialTone Generator ; ;************************************************* ;This routine selects and generates the proper dial tone, ; correspondingto our current (roam, holler, etc) status. dtone: push psw jblock,serv_check mov dptr,#table_350 ; 350 hz for lock jmp tone_outserv_check: jb noserv,roam_check mov dptr,#table_620 ;620 hz tone forno-serv jmp tone_out roam_check: jb sw_dialtone,normal ;If option sw isclosed (=0) make a ; diff dial tone for roam jb roam,normal movdptr,#table_roam ;440-620 hz for roam jmp tone_out normal: movdptr,#table_dt ;350-440 hz (normal DT) tone_out: mov lowpoint,dpl;Remember where the table starts mov highpoint,dph mov ccapm1,#01000010b;Enable the tone pop psw ret;************************************************* ; ; Get a digit fromthe handset keypad ; ;*************************************************; This routine processes the digit input and/or process flags. ; Onreturn - returns data in acc get: push psw get1: mov f_cmds,#3 ;Flagindicates which functions apply call trucmd ;Perform any TRU specificcommands call watchdog ; Wait for a pulse. If the pulse was not flaggedas a pulse dial input ; by EXTINT0 (Off_Hook_Service), we check for aDTMF digit input. If it ; was a pulse dial input then we continuecounting pulses, until 250 ms ; has passed after receiving the lastpulse. At that point we consider ; assembling the pulse dial digitcompleted, so we copy it into the acc, ; and set the fdig_ready flag.get_pulse: jnb fdigit,get_dtmf clr fdtone ;Clear dial tone flag movccapm1,#0 ;Turn off dial tone mov a,#2 ;If there was an input clr c;Clear carry for subtraction subb a,time_off2 ;See if 213.3 msec (3x71.1ms) passed jnc get_dtmf ;If not yet, then digit not complete mov a,#131clr c ;Clear carry for subtraction subb a,time_offi ;See if additional36.7 msec ; (132x277.8 usec) has passed (total ; time of 250 msec) jncget_dtmf ;If not yet, then digit not complete mov a,pulse digit ;Putdigit in a mov pulse digit,#0 ;Clear for next dig setb fdig_ready ;Toshow a digit ready cir fdigit ;Clear the flag ; If a DTMF dial digit isready, copy it into the acc. Check for special ; conditions, flash, hangup etc. Branch on special conditions, or continue ; checking for morepulse(s), and/or completed digits. get_dtmf: jnb fdtmfin,hang clr fdtone;Clear dial tone flag mov ccapm1,#0 ;Turn off dial tone clr fdtmfin;Clear dtmf input flag mov a,px1_temp ;Put digit in acc anl a,#0fh ;Keeponly low 4 bits setb fdig_ready ;To show a digit ready ; Check forhangup (pulse > 700ms). hang: jnb fhang,gflash ;If no hangup pop pswtest_lc3: call hup dec sp ;Correct stack pointer dec sp ;Leaving subroutwithout ret jnb fremote hup,no_remote ; Brif no remote hup occured clrfremote_hup no_remote: jmp start ; Exit, somebody hung up ; Check forflash (200 < pulse < 700ms). gflash: jnb fflash,time ;If no flash clrfflash ;Clear flash flag mov ccapm1,#0 ;Turn off dial tone jbfdtone,#just_flash ;If dial tone on just a send for last ; number redialjb fsend,just_flash ;If send flag is set don't put digits, ; just a sendclr fdtone ;clear dial tone flag pop psw dec sp ;Correct stack pointerdec sp ;Leaving subrout without ret jmp send_it ;Output all digits +send ; Transmit only a SEND code, but not the digits, if ; either theDial Tone or the Send flag is high. Just_flash: clr fdtone ;Clear dialtone flag mov f_cmds,#5 call trucmd mov a,#send ;Send code call wrbussetb fsend ;Send flag pop psw ; Restore flags dec sp ;Correct stackpointer dec sp jmp wait ; Back for digit(s), hangup etc. ; If we did notdial a complete phone number yet, and 40 second passed ; since the lastkey punch, then we start a 1 minute holler tone. time: jnbftime,send_time ;If no timeout pop psw dec sp ;Correct the stack pointrdec sp ;Leaving subrout without ret jmp rohtone ;Then no rohtone ; Checkif it time to send (4 sec expired since last key.) send_time: jnbfsendtimer,unlock_time mov r6,time_off2 ;71.1 ms timer in r6 cjner6,#56(unlock_time ;Check for 4 sec (56x71.1ms = 3.98 sec) clrfsendtimer pop psw dec sp ;Correct stack pointer dec sp ;Leaving subroutwithout ret jmp send_it ;Output digits and send ; Check if unlock wasrequested. unlock_time: jnb funlocktimer,lock_time mov r6,time_off2;71.4 ms timer in r6 cjne r6,#28,look ;Check for (28 x 71.4 ms =) 2secclr funlocktimer pop psw dec sp ;Correct stack pointer dec sp ;Leavingsubrout without ret jb lock,no_unlock ; Do not unlock, if alreadyunlocked jmp unlock_it no_unlock: setb fonhook ;As if on hook setb ie0;Go to ExtInt0 service jmp start ;Just like off hook again ;Flocktimeradded to allow lock to timeout on less than 4 digits. Go_lock ;labelmust be added to TRU and also setting of flocktimer (if necessary).lock_time: jnb flocktimer,look ; Brif not mov r6,time_off2 ; 71.4 mstimer in r6 cjne r6,#28,look ; Check for (28*71.4 ms = 2 sec) clrflocktimer pop psw dec sp ; Correct SP dec sp jmp go_lock ; Check if wegot a (complete) digit. look: jb fdig_ready,got_a_digit jmp get1 ;Lookagain if no digit in ; We got a digit (pulse or DTMF), return it in theacc. got_a_digit: clr fdig_ready ;Clear the digit ready flag got_inuse:mov time_off1,#0 ; Restart timers on every digit input mov time_off2,#0mov time_off3,#0 pop psw ret;************************************************* ; ; Get a digit fromthe handset keypad ; ;*************************************************; This routine processes the digit input and/or process flags. ; Onreturn - returns data in acc get_test: push psw ; If a DTMF dial digitis ready, copy it into the acc. Check for special ; conditions, flash,hang up etc. Branch on special conditions, or continue ; checking formore pulse(s), and/or completed digits. get_dtmf_test: jnbfdtmfin,no_dtmf_test clr fdtone ;Clear dial tone flag mov ccapm1,#0;Turn off dial tone clr fdtmfin ;Clear dtmf input flag mov a,px1_temp;Put digit in acc anl a,#0fh ;Keep only low 4 bits setb fdig_ready ;Toshow a digit ready no_dtmf_test: clr fdig ready ;Clear the digit readyflag mov time_off1,#0 ; Restart timers on every digit input movtime_off2,#0 mov time_off3,#0 pop psw ret;**********************************************************************;send dtmf - send a dial tone;**********************************************************************send_dtmf: call watchdog clr dtmf_out ; enable the dtmf tone callwrite_io_m_b setb dtmf_out ; enable the dtmf tone call write_io_m_b ret;**********************************************************************;clr_dtmf - send a dial tone;**********************************************************************disable_dtmf: clr dtmf_out ; enable the dtmf tone call write_io_m_b retdelay_dtmf: ; delay the DTMF tone clr tr1 mov time_off2,#0 movtime_off1,#0 setb tr1 wait_until_dtmf: mov a,time_off2 call watchdogcjne a,#4,wait_until_dtmf ; wait 40 msec to stop the dtmf ret;************************************************* ; ; ROH tonegenerator ; ;************************************************* ; 40 sechas passed after we lifted the handset w/o dialing any digits, ; orsince we have dialed the last digit. We shall generate an ROH tone ;(interrupted at 80 msec intervals) for 1 minute or until we hang_up, ;whichever happens first. rohtone: clr ftime ; Clear the flag clr fdtone; Clear dial tone flag so changes in ; indicators won't change roh tonemov dptr,#table_400 mov highpoint,dph ; Remember table location movlowpoint,dpl setb roh_boost ; Boost the audio call write_px2 rohtone_on:mov ccapm1,#01000010b ; Turn on the tone ; Loop here for 1 minute, oruntil hang_up. check_hangup: call watchdog ; Refresh watchdog whilewaiting here jnb fhang,check_timeout ; Brif still off hook test_lc4:call hup ; Do orderly hang up if back on hook jmp start ; Brand newstart check_timeout: jb frohtimeout,roh_timeout ; Brif ROH timed out(after 1 minute) jb roh_on,rohtone_on mov ccapm1,#0 ; Turn off the tonejmp check_hangup ; This loop toggles roh on and off roh_timeout: movccapm1,#0 ; Turn off the tone clr roh_boost ; Unboost the audio setbloopswitch_(—) ; Open the loop call write_px2 ; Out to the porttest_lc5: call hup ; Do hang up routine jnb sw_gndstart,looptest ; Doloop test if loop start jmp looptest_end ; No loop test if ground start,just ; leave loop open til ring ground ; Get here if we are in Loopstartmode. looptest: mov b,#40 ; Set up 2 sec delay (40 x 50 ms) loopt1: mova,time_on2 ; Get current onhook time add a,#5 ; Add 50ms to present timeloopt2: call watchdog ; Refresh watchdog cjne a,time_on2,loopt2 ; Minordelay is 50 ms djnz b,loopt1 ; Wait 2 sec total clr loopswitch_(—) ;Close loop in every 2 sec to check call write_px2 ; if phone was putback on hook mov looptest_timer2,#215 ; Load 2.22msec delay (8 x 277.8usec) loopt3: mov looptest_timer,#0ffh ; To allow enough time for theSLIC djnz looptest_timer,$ ; chip to indicate the hook status callwatchdog ; Refresh watchdog djnz looptest_timer2,loopt3 jblc_,looptest_end ; Brif no loop current (back on hook) setbloopswitch_(—) ; Open loop switch again call write_px2 jmp looptest ;Wait here until hung up looptest_end: clr frohtimeout ; 0 = has beenhung up, or in GS mode mov time_on1,#0 ; Reset on hook timers movtime_on2,#0 jmp start ; Start new;************************************************* ; ; Subroutine forhang up ; ;************************************************* hup: callwatchdog clr ex0 ;Disable ExtInt0 (offhook, LC_) clr fdigit ;In casehangup while pulse dialing mov pulse_digit,#0 ;In case hup during pulsedigit input clr fdig_ready ;In case hup during pulse/dtmf input clrfdtmfin ;In case hup during dtmf digit input clr flocktimer ;In case hupduring locking clr funlocktimer ;In case hup during unlocking jnbsw_gndstart,hup1 ; Brif loopstart setb loopswitch_(—) ;Open loopsw for750ms if groundstart call write_px2 ; to simulate hup mov a,time_on2;Incs every 10 ms add a,#75 ;For 750 ms delay push acc ;Store for laterjmp hup2 hup1: jb frohtimeout,hup2 clr loopswitch_(—) ;If loopstart callwrite_px2 hup2: clr ftime ;Clear timer flag clr fsendtimer ;Clear sendtimer flag mov ccapm1,#0 ;Make sure dtone is off clr fdtone ;Clear thedial tone flag clr roh_boost ;Normal audio call write_px2 jbfremote_hup,no_end_sent ;No end code if remote hup, since it ; isn'tneeded and clears the buffer ; on the Motorola unnecessarily. mova,#endcall ;Put end code call wrbus ;Send it to TRU first, then resetflag no_end_sent: clr fsend ;in case digits sent or ALERT answered setbhookswout ;Show on hook to TRU clr hookswout ;Ditto jnb sw_gndstart,hup4;Don't do timing if loop start pop acc ;Get delay time back clr c ;Clearcarry flag for next hup3: call watchdog cjne a,time_on2,$+3 ;Wait 750 msto allow loop to open ; and pbx to see it as disconnect. ; jmp to nextinstruction in any case jnc hup3 ;No carry til time_on2 greater than acc; (in case bus write took more than ; 750 ms) hup4: setb fonhook ;Seton-hook flag clr fhang ;Clear hang-up flag clr f_one_sec ;So timer canstart again when off hook clr f_inuseofftiming ;Reset flag setb ex0;Enable extint0 (offhook) ret;************************************************* ; ; TRU status update; ;************************************************* ; Routine updatesTRU status every 71.4 ms, and turns ringer ; on and off. Also checks for3.9 second interval after a ring. update_displays: push acc push pswupspec1: jnb fspec1,continue_update ;Check special flag call spec1;Special routine in TRU section continue_update: jbtest_enable,go_to_self ; check if test started mov a,lamps_temp ;Holdvalues for comparison later mov c,roam cpl c ; No real lamps for theMaxjack! mov roamlamp,c ;Roam indicator (just for storage) mov c,noservcpl c mov noservlamp,c ;Noserv indicator (just for storage) mov c,lockcpl c mov locklamp,c ;Lock indicator (just for storage) mov c,inuse cplc mov inuselamp,c ;Inuse indicator (just for storage) call write_io_c ;update the LEDS jb sw_dialtone,not_maint ;If option sw is out (=1) ; notmaintenance module test_push: call read_io_m_a ; read push button anla,#00010000b cjne a,#0h,not push setb test_enable ; init maint test setbfremote_hup ; set remote hup for 700 ms setb loopswitch_(—) ;Other sidehas disconnected call write_px2 not_push: jnb test_enable,not_maint ;check if test started go_to_self: jnb test_end,not_error_yet ; if errorwas found jnb error_flag,pass_ok test_led: mov r0,#error_code mov a,@r0rl a rl a rl a rl a mov lamps_temp,a call write_io_c ; update the LEDSsetb ext_led ; turn on external led 1 minute jmp write_to_c pass_ok: clrext_led ; turn on external led 1 minute jmp write_to_c not_error_yet: jbext_led,clr_led setb ext_led ; turn on external led while testing jmpwrite_to c clr_led: clr ext_led ; turn off external led while testingwrite_to_c: call write_io_m_c ; turn on/off the external led not_maint:mov a,lamps_temp ;Hold values for comparison later jb frohtimeout,compare  mov c,ap2 ; Check we are in ALERT state, anl c,/ap1 ; (i.e.:incoming call waiting) jnc compare ; Brif not ALERT (no incoming call)jnb fonhook,compare ; Brif off hook, don't ring bell! clr loopswitch_(—); Close loop switch if ALERT state, call write_px2 ; (incoming call iswaiting) jb fcall,reset_ring_timer ; Brif ringing is already in progresssetb fcall ; 1 = start ringing (ALERT detected) mov bell_timer,#0 ;Reset timers mov bell_timer2,#0 setb fbellsound ;Flag bell sounding movdptr,#table 20 ;Point to 20 hz table for ring mov lowpoint,dpl ; Saveringer table starts mov highpoint,dph setb twenty_hz_pwm ;So pin can bepwm mov ccapm27,#01000010b ;Enable pwm test1: 0_(—) clr ring ;Turn onring ps setb no_ring call write_px2 ;Out to port reset_ring_timer:;Reset between-rings timer as long as mov ring_timer,#0 ; we are inALERT state compare: xrl a,lamps_temp ;Bits that differ will be = 1 jnbf_one_sec,dtbits ;Wait 1 sec after off hook before ; looking at inuselamp, prevents ; disconnect if offhook soon after hup mov c,acc.7 ; GetINUSE status anl c,/inuselamp ; 1 = not INUSE jnc timing_in_use_off;Start timer if INUSE lamp just turned ; off mov in_use_off_timer,#28;Reset timer for 1.99 sec(28 x 71.1 ms) setb f_inuseofftiming ;Show inuse off timer is working now timing_in_use_off: jnbinuselamp,cont_in_use_timing ;If inuse lamp still off clrf_inuseofftiming ;Otherwise clear flag and stop timingcont_in_use_timing: jnb f_inuseofftiming,dtbits ;Continue timing if flagis set djnz in_use_off_timer,dtbits ;When timer hits 1.99 sec,disconnect clr f_inuseofftiming ;Clear flag jb fonhook,dtbits ;If localhangup don't do remote hangup ; We get here if the other party hang-upand we did not put the phone ; back on hook within 2 seconds.disconnect: setb fremote_hup ; set remote hup for 700ms setbloopswitch_(—) ;Other side has disconnected call write_px2 dtbits: anla,#01110000b ;Just check bits that affect dial tone jz ring_timeout ;Ifnothing chgd jnb fdtone,ring_timeout ;Or if DT not on already movccapm1,#0 ;Turn off current DT call dtone ;Change to new dial tonering_timeout: jnb fcall,update_done ;Don't time ring if no incoming callinc ring_timer ;Every 71.1 msec mov a,#53 ;54 x 71.1 ms= 3.84 sec clr c;Clear carry for subtraction subb a,ring_timer jnc update_done ;If notat least 3.84 sec with no ring jb fbellsound,update_done ;Also wait tilnot sounding ring check_stop_ring_ps: mov a,#3 ;4 x 25 ms = 100 ms clr csubb a,bell_timer2 ;Ready to do subtract jnc update_done ;When carry,100 ms jb ring_,check_stop_null ;Brif ring PS is already turned off setbring ;Else turn off ring PS now call write_px2 ;Out to port clr no_ringcall write_px2 ;Out to port check_stop_null: mov a,#7 ;8 x 25 ms = 200ms clr c ;Ready to do subtract subb a,bell_timer2 jnc update_done ;Whencarry, 200 ms mov ccapm2,#0 ;Stop pwm clr twenty_hz_pwm ;Leave outputpin low, pwm has run 100 ; ms longer than ring ps to smooth out ;waveform clr fcall ;0 = not ALERT, assure no ringing jnb swgndstart,update_done ;Brif loop start setb loopswitch_(—) ;GS didntanswer ring call write_px2 update_done: jb  fcall,no_reset_io jnb lc_;,no_reset_io jb frohtimeout,no_reset_io no_reset_io: pop psw pop acc ret;************************************************* ; ; Reload Watch DogCompare Word ; ;*************************************************watchdog: push ie clr ea ; Disable ints mov ccap4l,#0 ; Point to startof current page mov ccap4h,ch ; Current page pop ie ret;************************************************* ; ; Timer0 (TL0)on-hook interrupt service routine ;;************************************************* onhook_timer: pushpsw push acc clr tr1 ;Stop offhook timer clr tf1 ;Clear pending ints byoffhook timer mute_check: jb mute,on_spec2 ;If already muted skip thissetb mute ;Mute rx audio to prevent false ; decoding of audio ring asdtmf, ; also prevent audio feedback call write_px2 ;Out to porton_spec2: jnb fspec2,on_spec2_done ;Check flag call spec2 ;Call specialroutine in TRU section on_spec2_done: djnz display_delay,gs_init ;In71.1 ms call update_displays ;Every 71.1 ms gs_init: jbfcall,cont_service ;Skip outgoing GS init on incoming call jnbsw_gndstart,cont_service ; Brif not in GS mode jnb fonhook,cont_service;Don't look for ring ground to start ; GS until really hung up jbring_ground_,cont_groundstart clr loopswitch_(—) ;Groundstart servicewas requested call write_px2 mov gndstart_timer1,#0 movgndstart_timer2,#0 ;Init timer cont_groundstart: inc gndstart_timer1;subscriber has released ring ground mov a,gndstart_timer1 cjnea,#90,cont_service ;25 ms (90 x 277.8 us) inc gndstart_timer2 ;Every 25msec mov gndstart_timer1,#0 ;Reset for next count of 90 mova,gndstart_timer2 cjne a,#40,cont_service ;1 sec (40 x 25 ms) setbloopswitch_(—) ;Open loop in 1 sec if sub didn't ; complete loop callwrite_px2 cont_service: jb fcall,ring_control ; Brif ALERT state togenerate ringing jmp onhook_timers ; Else just do timers update ; Weshall ring the bell if the TRU is in ALERT state, (an incoming ; call iswaiting to be picked up). ring_control: jb fbellsound,timing_ring ;Whenbell not sounding during ring ; cycle, check for ring ground to ;indicate answer due to ringing ; pulses jb ring_ground_,timing_ring ;Ifno ring ground,time the ring.Now ; ignore the pulse on ring ground as ;ringer stops mov a,bell_timer2 ;Incs every 25 ms cjnea,#0,start_bellsound ;Observe any ring ground after 25 ms mov a,#28 ;29x 277.8 us = 8.1 ms clr c ;Ready to subtract subb a,bell_timer jnctiming_ring ;No carry til 8.1 ms after ring stops. ;Only ignore ringground 8.1 ms jmp start_bellsound ;If ring ground indicates came offhook ; during silent time, start 20 hz ; again to force ring triptiming_ring: inc bell_timer ;Every 277.8 usec mov a,bell_timer cjnea,#90,ringer_on ;25 msec (90 x 277.8 us) mov bell_timer,#0 ;Reset fornext 90 inc bell_timer2 ;Every 25 msec ringer_on: jnbfbellsound,ringer_off ;Brif, bell is not sounding now ; The on timeringer modified from 1.95 secs to 1.975 secs, because the ring ; stopsat the positive peak which causes a continous ringing. This problem ;was producing with 5 ringer box applying with maxjack. (ssh)check_stop_bellsound: mov a,bell_timer2 ;Get elapsed “bell on” time cjnea,#59,onhook_timers ;Brif less then 79 x 25 ms = 1.975 secs mova,bell_timer ;45 x 277.8 us = 12.5ms (total 1.987s cjnea,#45,onhook_timers ;Ring stops after 1.987secs on negative ; peak,chops off last quarter cycle ; for proper ring trip stop_bellsound: movccapm2,#0 ;Enable pwm clr fbellsound ;0 = the bell not sounding movdptr,#table_null ;Point to table of null tone (nulltone ; causes ringerto have zero AC out, ; only battery) mov lowpoint,dpl ;Save the nulltable start mov highpoint,dph mov ccapm2,#01000010b ;Enable pwm clr eaclr no_ring call write_px2 setb ea call watchdog jmp reset_bell_timers;Reset timers ringer_off: mov a,bell_timer2 cjne a,#120,onhook_timers ;4sec with no ring (160 x 25) start_bellsound: call reset_io callwrite_px1 call write_px2 clr ea setb no_ring call write_px2 setb ea movccapm2,#0 ;Enable pwm mov dptr,#table_20 ;Point to table for 20 hz movlowpoint,dpl ;Remember where table starts mov highpoint,dph movccapm2,#01000010b ;Enable pwm test_relay1: setb fbellsound ;1 = bell issounding now reset_bell_timers: mov bell_timer,#0 mov bell_timer2,#0onhook_timers: inc time_on1 ,25;Every 277.8 usec while on hook mova,time_on1 cjne a,#36,onhook_done ;36 x 277.8 ms = 10 ms inc time_on2;Every 10 msec while on hook mov time_on1,#0 ;Reset for next 36 mova,time_on2 cjne a,#0,not_inc255 inc test_min ; 10 msec x 255 = .255 secnot_inc255: jb frohtimeout,onhook_done ;Skip hang up stuff until looptest ; checks out ok test_fhang1: jb fonhook,onhook_done ;Don't doanother hang up, one has been ; done already test_fhang2: mov a,time_on2;ON HOOK STATUS ; cjne a,#70,onhook_done ;700 msec indicates hang up ;cjne a,#30,onhook_done ;700 msec indicates hang up test_fhang3: setbfhang ;Set the hang up flag clr f_inuseofftiming ; Stop timer to preventpossible remote ; hup onhook_done: pop acc pop psw reti;************************************************* ; ; Timer1 (TH0)off-hook interrupt service routine ;;************************************************* offhook_timer: pushpsw ; Save entry status push acc jnb fspec2,check_strobe ; Brif spec2 isnot enabled call spec2 ; Else do TRU specific task ; Check for a DTMFdigit, and read it from the MT8870 if there ; is one available.check_strobe: call read_px1_strobe jb strobe,decode_dtmf ; Brif a DTMFdigit is waiting clr fdecoder_busy ; Reset if strobe is gone jmp ttime ;and just do offhook timing task decode_dtmf: jb fdecoder_busy,ttime ;Brif DTMF digit already was read call read_px1 ; Else read it now setbfdtmfin ; 1 = DTMF digit received! setb fdecoder_busy ; 1 = DTMF digitbeing processed ; Check elapsed offhook time, update displays in every71ms, and ; start-end ROH tone as required. ttime: inc time_off1 ; Bumpminor offhook timer (@ 277.8us) mov a,time_off1 ; Get minor offhook time;JMP TEST_HOOK cjne a,#0,t_one_sec ; Brif < 256*277 us = 71.1ms inctime_off2 ; Bump major timer (every 71.1ms) call update_displays ; Doupdate every 71.1ms mov a,time_off2 ; Get major offhook time cjnea,#0,t_one_sec ; Brif < 256*71.1ms=18.2sec inc time_off3 ; Bump totaloffhook timer (@ 18.2sec) t_one_sec: mov a,time_off2 ; Get major offhooktime cjne a,#14,trohtimer ; Brif < 14*71.1ms=995ms passed setb f_one_sec; so change in INUSE lamp won't cause ; hangup if phone taken off hooktoo ; soon after hangup trohtimer: jb fsend,tdone ; Brif we originatedthe call (no ROH) jnb inuse,tdone ; Brif we are INUSE (no ROH either)inc r5 ; Bump minor ROH start/end timer cjne r5,#36,trohstart ; Brif <35*277.8us=10ms passed inc r7 ; Bump minor ROH on/off timer mov r5,#0 ;Reset for another pass (10ms) cjne r7,#10,trohstart ; Brif <10*10ms=100ms passed cpi roh_on ; Toggle ROH on/off every 100ms movr7,#0 ; Reset for another on/off phase trohstart: mov a,time_off3 ; Gettotal elapsed offhook time cjne a,#2,trohquit ; Brif < 2x18.2=36.3secpassed mov a,time_off2 ; Get additional major time too cjnea,#51,trohquit ; Brif < 40sec total offhook setb ftime ; 1 = ROH periodstarted trohquit: mov a,time_off3 ; Get total offhook time again cjnea,#5,tdone ; Brif < 5*18.2=91sec passed mov a,time_off2 ; Get additionaimajor time too cjne a,#127,tdone ; Brif < 91+(127*71.1 ms)=100sec setbfrohtimeout ; 1 = ROH period expired tdone: jnb f_start,tdone0 ; Brifnot timing 500ms after “first” mov a,time_off2 ; Get elapsed offhooktime cjne a,#4,tdone1 ; Brif < 285ms elapsed cjne a,#7,tdone1 ; Brif <500ms elapsed clr f_start ; Reenable onhook ints after 500ms ; Get hereonly after 500ms passed following the first offhook after ; every hangup. tdone0: jnb lc_,tdone1 ; Brif offhook now test_tr0: clr tr1 ; Elsestop the off hook timer setb tr0 ; and start on hook timer tdone1: popacc ; Restore pop psw reti;************************************************* ; ; ExternalInterrupt 0 service routine ;;************************************************* offhook_edge: jbfrohtimeout,offhook_return1 jnb fcall,not_inc_call jnb no_ring,ok_waitsetb ring_(—) ;Turn off bell call write_px2 clr no_ring call write_px2setb return_ring clr ie0 ;Discard pending EX0 (LC_) interrupt clr tr0 ;Turn off onhook timer and flag clr tf0 ; in case onhook_timer intpending ok_wait: mov r7,#0ffh loop_ring: mov r6,#0ffh djnz r6,$ callwatchdog djnz r7;loop_ring jnb lc_,no_set esta_set: jnbreturn_ring,do_not_return call reset_io call write_px1 call write_px2setb no_ring clr ring_(—) ;Turn off bell call write_px2 clr return_ringmov r7,#07fh loop_ring1: mov r6,#0ffh djnz r6,$ call watchdog djnzr7,loop_ring1 do_not_return: call reset_io call write_px1 call write_px2setb tr0 ; Turn off onhook timer and flag mov tl0,#0 retioffhook_return1: jmp offhook_return no_set: not_inc_call: clr tr0 ; Turnoff onhook_timer and flag clr tf0 ; in case onhook_timer int pendingpush psw push acc clr ie0 ;Discard pending EX0 (LC_) interrupt setb tr1;Start off-hook timer clr fhang ;Clear hangup flag for safety TnOVth0,#0 ;Reset offhook timer mov time_off1,#0 ;Timers incremented by th0interrupts mov time_off2,#0 mov time_off3,#0 clr mute ;Unmute rx audiocall write_px2 jnb fonhook,check_flash ;Brif wasn't hung up ; comingback off hook clr fonhook ;Clear the flag, it was hung up, nowok_offhook: jnb fcall,set_hook_flag ;Brif not in ALERT state setbfanswer ;1 = off hook during incoming call clr fcall ;Clear the ALERTflag (answering call) setb ring_(—) ;Turn off bell call write_px2 clrno_ring call write_px2 mov ccapm2,#0 ;Stop ringer PWM clr twenty_hz_pwm;Leave output pin low jmp offhook_done set_hook_flag: setb fhook ; Showoff hook if not in ALERT state jmp offhook_done check_flash: mov a,#19;20 x 10 = 200 msec clr c ;Clear carry for subtraction subb a,time_on2;200-700 msec is flash jnc check_digit jnb lock,offhook_done ; No flashif TRU is locked ;; setb fflash ;Set flash flag jmp offhook_donecheck_digit: mov a,#1 ;2 x 10 = 20 msec clr c ;Clear carry forsubtraction subb a,time_on2 ;20-200 msec is pulse jnc offhook_done ;Justa glitch inc pulse_digit ;Contains the number setb fdigit ;Possibledigit flag offhook_done: mov time_on1,#0 ;Reset on-hook timers so theycan be mov time_on2,#0 ; restarted on hang up mov tl0,#0 pop acc pop pswoffhook_return: reti ;*************************************************; ; PCA Interrupt Routine ;;************************************************* ; PCA interrupts aregenerated by using module 0's (software timer) ; compare/match option onevery low count = FF match. This way we can ; generate an interrupt atthe end of each page, 00FF-0100, 01FF-0200 ; etc. which gives us aninterrupt at every (256*1.085us) 278us. ; This Maxjack implementation isusing conditional assembly to produce ; a modified PCA service routinefor TRUS with extremely high data transfer ; rates (Audiovox requiresthe alternate PCA routine). $ge pca_service: %if(%intmask ne 0) then (push ie ;Going to simulate third interrupt ; priority level movie,#%intmask ;Defined in TRU section call masklabel ;To execute the retipush acc push psw mov a,ccapm1 ;Look at tone pwm orl a,ccapm2 ;Look atring pwm anl a,#00000010b ;Just look at pwm bit jz pca_done ;Skip nextpart if no tone or ring ; output do_pca: mov a,#0 ;Initialize pointerread_table: movc a,@a+dptr ;Get data from table cjne a,#255,write_tonemov dph,highpoint ;Reset index this is end of table mov dpl,lowpoint mova,#0 ;So index will be right jmp read_table ;Read first entrywrite_tone: mov ccap1h,a ;Put data in tone pwm mov ccap2h,a ;Put datainto ring pwm -only tone ; or ring pwm is running at any given ; timeinc dptr ;Point to next table entry for next ; time pca_done: clr ccf0;Reset the module 0 flag clr ea ;Disable ints mov ccap01,#0ffh ;Reloadlow match and suspend ; comparator mov a,ccap0h ;Get last page inc a;Point to next page mov ccap0h,a ;Load high match and restart comparatorsetb ea ;Enable ints again pop psw pop acc pop ie ;Restore original intsret masklabel: reti ) else ( push acc push psw mov a,ccapm1 ;Look attone pwm orl a,ccapm2 ;Look at ring pwm anl a,#00000010b ;Just look atpwm bit jz pca_done ;Skip next part if no tone or ring ; output ; If weare generating Dial Tone now, then get the current ; value from theselected tone table, and send it to the PCA1 ; so that proper DTMFfrequency is generated on CEX1 (p1.4). do_pca: mov a,#0 ;Initializepointer read_table: movc a,@a+dptr ;Get data from table cjnea,#255,write_tone mov dph,highpoint ;Reset index, this is end of tablemov dpl,lowpoint mov a,#0 ;So index will be right jmp read_table ;Readfirst entry write_tone: mov ccap1h,a ;Put data in tone pwm mov ccap2h,a;Put data into ring pwm only tone or ; ring pwm is running at any given; time inc dptr ;Point to next table entry for next ; time pca_done: clrccf0 ;Reset the module 0 flag clr ea ;Disable ints mov ccap01,#0ffh;Reload low match and suspend ; comparator mov a,ccap0h ;Get last pageinc a ;Point to next page mov ccap0h,a ;Load high match and restartcomparator setb ea ;Enable ints again pop psw pop acc reti ) fi $noge;************************************************* ; ; I/O SupportRoutines ; ;************************************************* write_px1:; Data from px1 temp to px1 push ie ; Save interrupt status clr ea ; Nointerruptions clr io_select push acc push 0 ; Push r0 setb a0 ; B clr a1mov a,px1 temp anl a,#11110000b mov b,a mov a,px2_temp anl a,#0001111b ;Keep the input bits high orl a,b mov r0,#00h ; Low address for I/O chippx1 latch movx @r0,a setb a0 setb a1 pop 0 ; Restore r0 pop acc pop ie ;Restore interrupt status ret read_px1: push ie ; Save interrupt statusclr ea ; No interrupts clr io_select push acc push 0 ; Push r0 clr a0 ;A clr a1 mov r0,#0h ; Low address byte for I/O chip px1 pins movx a,@r0anl a,#00001111b ; Mask the output bits anl px1_temp,#11110000b ; Maskthe input bits in px1_temp orl px1_temp,a ; Combine inputs anl outputsinto one ; byte setb a0 setb a1 pop 0 ; Pop r0 pop acc pop ie ; Restoreinterrupt status ret read_px1_strobe: push ie ; Save interrupt statusclr ea ; No interrupts clr io_select push acc push 0 ; Push r0 clr a0 ;A clr a1 mov r0,#0h ; Low address byte for I/O chip px1 pins movx a,@r0mov io_status,a setb a0 setb a1 pop 0 ; Pop r0 pop acc pop ie ; Restoreinterrupt status ret write_px2: ; Data from px2_temp to px2 push ie ;Save interrupt status clr ea ; No interruptions clr io_select push accpush 0 ; Push r0 setb a0 ; B clr a1 mov a,px1_temp anl a,#11110000b movb,a mov a,px2_temp anl a,#00001111b ; Keep the input bits high orl a,bmov r0,#00h ; Low address for I/O chip px1 latch movx @r0,a setb a0 setba1 pop 0 ; Restore r0 pop acc pop ie ; Restore interrupt status retwrite_io_c: ; Data from px2_temp to px2 push ie ; Save interrupt statusclr ea ; No interruptions clr io_select push acc push 0 ; Push r0 clr a0; B setb a1 mov a,lamps_temp anl a,#11110000b rl a rl a rl a rl a movr0,#00h ; Low address for I/O chip px1 latch movx @r0,a setb a0 setb a1pop 0 ; Restore r0 pop acc pop ie ; Restore interrupt status retread_px2: push ie ; Save interrupt status clr ea ; No interrupts clrio_select push acc push 0 ; Push r0 clr a0 ; C setb a1 mov r0,#0h ; Lowaddress for I/O chip px2 pins movx a,@r0 anl a,#11110000b ; Mask theoutput bits anl px2_temp,#00001111b ; Mask the input bits in px2_tempor1 px2_temp,a ; Combine inputs/outputs into one byte setb a0 setb a1pop 0 ; Pop r0 pop acc pop ie ; Restore interrupt status retread_io_m_a: ; Data from px2_temp to px2 push ie ; Save interrupt statusclr ea ; No interruptions setb io_select ; push acc push 0 ; Push r0 clra0 ; b clr a1 mov r0,#00h ; Low address for I/O chip px1 latch movxa,@r0 setb a0 setb a1 clr io_select pop 0 ; Restore r0 ; pop acc pop ie; Restore interrupt status ret write_io_m_b: ; Data from px1_temp to px1push ie ; Save interrupt status setb io_select clr ea ; No interruptionspush acc push 0 ; Push r0 setb a0 ; B clr a1 mov a,io_m_b mov r0,#00h ;Low address for I/O chip px1 latch movx @r0,a setb a0 setb a1 clrio_select pop 0 ; Restore r0 pop acc pop ie ; Restore interrupt statusret write_io_m_c: ; Data from px2_temp to px2 push ie ; Save interruptstatus setb io_select clr ea ; No interruptions push acc push 0 ; Pushr0 clr a0 ; B setb a1 mov a,io_m_c mov r0,#00h ; Low address for I/Ochip px1 latch movx @r0,a setb a0 setb a1 clr io_select pop 0 ; Restorer0 pop acc pop ie ; Restore interrupt status ret reset_io_m: push ie ;Save interrupt status clr ea ; No interrupts setb io_select push accpush 0 ; Push r0 setb a0 ; Control setb a1 mov r0,#0h ; Low address forI/O chip px2 pins mov a,#10010000b movx @r0,a setb a0 setb a1 clrio_select pop 0 ; Pop r0 pop acc pop ie ; Restore interrupt status retreset_io: push ie ; Save interrupt status clr ea ; No interrupts clrio_select push acc push 0 ; Push r0 setb a0 ; Control setb a1 mov r0,#0h; Low address for I/O chip px2 pins mov a,#10011000b movx @r0,a setb a0setb a1 clr io_select pop 0 ; Pop r0 pop acc pop ie ; Restore interruptstatus ret ;************************************************* ; ;Support Routines ; ;************************************************* ;Generic messages between the TRU and Celjack can be save to aid ; indebugging. This message buffer is from 90h to FFh. clr_msg: push 1 ;Save R1 mov r1,#msgbuf_start ; Point to message buffer start movmsg_ptr,r1 ; Save buffer start clr_msg1: mov @r1,#55h ; Fill with 55hmask inc r1 ; Point to next location cjne r1,#msgbuf_end,clr_msg1 ; Tilend of the buffer pop 1 ; Restore R1 ret savemg: push 1 ; Save R1 movr1,msg_ptr ; Get current pointer cjne r1,#msgbuf_end,savem1 ; Brifmessage bufferis not full yet mov r1,#msgbuf_start ; Repoint to startwhen full savem1: mov @r1,a ; Save msg in buffer inc r1 ; Advancepointer mov msg_ptr,r1 ; Save advanced for next time pop 1 ; Restore R1exit: ret ; Clear copy of handset's LCD display from ram display buffer. clr_dsp: push 1 ; Save R1 mov r1,#dspbuf_start ; Point to messagebuffer start mov dsp_ptr,r1 ; Save buffer start clr_dsp1: mov @r1,#0ffh; Fill with FFh mask inc r1 ; Point to next location cjner1,#dspbuf_end,clr_dsp1 ; Til end of display buffer pop 1 ; Restore R1ret ; Some TRUs must save the handset LCD display info, in a localdisplay ; buffer. save_dsp: push 1 ; Save R1 mov r1,dsp_ptr ; Getcurrent pointer cjne r1,#dspbuf_end,save_dsp1 ; Brif message buffer isnot full yet mov r1,#dspbuf_start ; Repoint to start when fullsave_dsp1: mov @r1,a ; Save msg in buffer inc r1 ; Advance pointer movdsp_ptr,r1 ; Update pointer for next time pop 1 ; Restore R1 save_dsp2:; include(SPAIN.asm) ret $nolist $include(SPAIN4.asm) $list nop nop end;TELEMAINTENANCE REMOTE REPORTING m_make_call - make a call to reportm_make_call: mov r0,#counter 1 ; Inicializamos el contador mov @r0,#03h; para 3 reintentos mov R0,#call_back2 ; clear call incomplete bit mova,@R0 anl a,#01111111b mov @R0,a mr_who_invoke: ; checking who invokethe test mov R0,#call_back2 ; and check if the test is enable mov a,@R0; for that option anl a,#01100000b mov r0,#options cjnea,#00000000b,mr_test _manual jmp mr_reset_invoked ;X00X XXXX - resetmr_test_manual: cjne a,#00100000b,mr_test_auto jmp mr_auto_invoked ;X01X XXXX - auto (timer) mr_test_auto: cjnea,#01100000b,mr_manual_invoked ; X10X XXXX - manual jmp mr_tele_invoked; X11X XXXX - telesupervisado mr_reset_invoked: jmp mr_who_invoke_endmr_manual_invoked: mov a,@r0 anl a,#00000010b jnz mr_who_invoke_end ;enabled jmp m_call_test_end mr_auto_invoked: jberror_flag,mr_auto_invoked_cont jmp m_call_test_endmr_auto_invoked_cont: ; mov a,@r0 ; an1 a,#00000001b jnzmr_who_invoke_end ; enabled jmp mr_who_invoke_end ; enabled ; jmpmr_call_test_end mr_tele_invoked: mov a,@r0 anl a,#00000001b jnzmr_who_invoke_end ; enabled jmp m_call_test_end mr_who_invoke_end:m_check_power: jnb power_,m_check_servc ; checking radio power jmpm_call_test_end m_check_servc: jb noserv,m_calling ; checking servicemov R0,#call_back2 ; used in the call back option mov a,@R0 orla,#10010000b mov @R0,a jmp m_call_test_end m_calling: ; Check if testhas been aborted by sliding the PCR jb test_enable,$+6 ljmpm_call_test_end call datos_radio mov a,#2 call delay2 ; 1 sec delayget_TMC_phone_Number: ; Check if test has been aborted by sliding thePCR jb test_enable,$+6 ljmp m_call_test_end mov r2,#0 movr1,#calling_num mov a,@r1 swap a anl a,#00001111b mov rl,a callcheck_tel_number cjne a,#0ffh,m_calling_con ;added on 10/12/94 to checknext available telephone number when a number ;for TelemaintenanceCenter has been found to be invalid call ext_watchdog mov a,#1 ; Wait2.5 secs delay call delay2 First Reset retry counters mov r0,#call_back2mov a,@r0 anl a,#11100000b ; erase call_back2 counters mov @r0,a movr0,#attempt mov a,@r0 swap a anl a,#00001111b ; get new call_back2counters mov r0,#call_back2 orl a,@r0 mov @r0,a ; mov r0,#calling_nummov a,@r0 swap a inc a swap a mov @r0,a anl a,#0f0h cjnea,#70h,get_TMC_phone_Number Last phone number reached, no more retrieswill be done Put all flags back to normal and exit mov R0,#call_back2mov a,@R0 anl a,#01111111b mov @r0,a call reset_clock clr test_pendingjmp m_pre_onhook ; Exit this routine m_calling_con: jb apl,m_sending jmpm_call_test_end m_sending: mov a,#send call wrbus mov r0,#8 mloopd8s: ;Check if test has been aborted by sliding the PCR jb test_enable,$+6ljmp m_call_end2 mov a,#1 call delay2 djnz r0,mloopd8s m_called: movr0,#count200 ; init counter for 200ms pulses mov @r0,#09 movr0,#count600 ; init counter for 200ms pulses mov @r0,#03 ; with 600msrest mov r0,#count_eng ; init counter for path engage mov @r0,#50h movr0,#count_tone ; Reset RingBack tone counter mov @r0,#0 mov T1_Timer,#0, Reset T1 (10 secs) timer clr mute ; enable audio signal callwrite_io_b ; ****; px2 mov time_10ms,#0 ; setting timers for 1 minutewaiting mov timer_10ms,#0 mov time_ls,#59 mov time_lm,#1 mov time_1hr,#1; dummy time to not allow timer go off m_check_inuse: jnbinuse,m_t_425_ver ; if inuse fails then jmp m_call_end m_t_425_ver: ;t_425 tone detected mov r0,#max_active ; init maximun time to check mov@r0,#250 mov r0,#filter ; init maximun time to check mov @r0,#00100001bmov io_m_a,#00100001b ; set mask for signal ; Check manual switch testabort jb test_enable,$+6 ljmp m_call_end2 ; Check T1 timer callCheck_T1_Timer jnc cont_ver jmp m_call_end ; Abort call, T1 timer iscompleted cont_ver: ; Check signal high time call verify_(—) ; callingto sub verify to get time on ; Check if test has been aborted by slidingthe PCR jb test_enable,$+6 ljmp m_call_end2 clr c subb a,#12 ; ****; 14falla −25 db −> 150ms jc m_nnt_yet ; if time on < .150 not valid mov a,bclr c subb a,#27 ; ****; 25 falla −8 db −> 250ms jc m_check_off_200 ; if.150<time on <.250 check time off mov a,b clr c subb a,#88 ;****; 90 ;if .250<time on <.9 s time not valid jc m_bad_timing mov a,b clr c subba,#138; ****; 140 ; if .900<time on<1.4s time not valid jncm_check_ring_b jmp m_bad_timing m_check ring_b: mov a,b clr c subba,#162 ;****;170 ; if 1.4s<time on<1.7s jc m_check_off_3s ; check forring back jmp m_bad_timing m_check_off_200: mov r0,#filter ; initmaximun time to check mov @r0, #11100001b mov io_m_a,#11100001b ; setmask for signal call verify_off ; calling to sub verify to get time off; Check if test has been aborted by sliding the PCR jb test_enable,$+6ljmp m_call_end2 clr c subb a,#15 jc m_bad_timing ; if time off <.150mov a,b ; not valid clr c subb a,#30 ; ****; 25 jc m_t_200_ok ; if .150<time off<.250 mov a,b clr c subb a,#50 jc m_bad_timing ; if .250 <timeoff <.500 mov a,b ; not valid clr c subb a,#75 jc m_t_600_ok if .500<time off <.700 ; not valid m_bad_timing: mov r0,#count200 ; resetcount200 = 6 mov @r0,#9 mov r0,#count600 ; reset count600 = 3 mov @r0,#3m_nnt_yet: call check_dtmf4 jnc m_nnt_yyet jmp m_path_engaged_detectedm_nnt_yyet: call read_io_m_a ; check 400,800 or 1020 tone anla,#10000000b cjne a,#100000000b,m_tone_ver_(—) ; if equal m_tone_verm_nnt_yet: call ext_watchdog; *; jmp m_not_yet m_tone_ver_: jmpm_tone_ver m_t_600_ok: mov r0,#count200 ; reset count200 = 6 mov a,@r0clr c subb a,#6 jnc m_t_600_cad jmp m_bad_timing m_t_600_cad: mov @r0,#9mov r0,#count600 ; if count 200 = 0 is busy tone mov a,@r0 dec a mov@r0,a jnz m_nnt_yet #Ynp m_congest_ok m_t_200_ok: mov r0,#count200 ; ifcount200 = 0 is busy tone mov a,@r0 dec a mov @r0,a jnz m_nnt_yet jmpm_busy_ok m_check_off_3s: mov r0,#filter ; init maximun time to checkmov @r0,#11100001b mov io_m_a,#11100001b ; set mask for signal movr0,#max active mov @r0,#250 ; loop up to max_active second callverify_off ; calling to sub verify to get time off clr c subb a,#250 jcm_bad_timing ; if time off <2.4s posible 400 tone call verify_off ;calling verify to get time off ; Check if test has been aborted bysliding the PCR jb test_enable,$+6 ljmp m_call_end2 mov a,b clr c subba,#36 jc m_bad_timing ; if time_off <2.8s posible 400 tone mov a,b clr csubb a,#60 ; if 2.8<time off <2.4+.65 = 3.5s ring jc m_RingBackToneOKjmp m_bad_timing m_not_yet: mov a,time_1m ; no detection yet jzm_time_out jmp m_check_inuse m_time_out: jmp m_call_end m_tone_ver: ;400, 800 or 1029 hz - tone detected mov r0,#max_active ; init maximuntime to check mov @r0,#240 ; maximun sampling time 240*10ms=2.4s movr0,#filter mov @r0,#10000000b mov io_m_a,#10000000b ; set mask forsignal call verify_ ; calling to sub verify clr c ; 70ms; ; subb a,#06 ;if tone > 800 msec tone ok subb a,#05 if tone < 50 msec, tone is invalidjc m_not_yet jmp m_tone_ok ; A valid RingBack tone was detectedm_RingBackToneOK: mov a,time_1m ; Check T4 timer jz m_time_out movr0,#count_tone ; Increment RingBack tone count inc @r0 mov T1_Timer,#0 ;Reset T1 timer mov r0;#filter ; Set signal mask mov @r0,#11100001b movr0,#max_active ; Set maximum signal detect time mov @r0,#250 jmpm_check_inuse m_path_engaged_detected: m_congest_ok: nop m_busy_ok: movR0,#call_back2 ; used in the call back option mov a,@R0 or1 a,#10010000bmov @R0,a jmp m_call_end2 m_tone_ok: ;__ A valid 1020Hz tone has beenreceived from the Telesupervision Center ;__ Start Transmission ofmessage packet now call ext_watchdog; *; ;change from 300ms to 2s on8/19/94 mov r1,#10 ;delay_2s: mov a,#20 call delay1 call ext_watchdogdjnz r1,delay_2 s call report_alarmas ; Check if test has been abortedby sliding the PCR jb test_enable,$+6 ljmp m_call_end2 mov time_10ms,#0mov timer_10ms, #0 mov time_1s,#10 mov time_1m,#3 mm_check_inuse: jnbinuse,mm_t_ver ; if in use fails then jmp m_call_end mm_t_ver: callread_io_m_a ; check 400, 800 or 1020 tone anl a,#10000000b cjnea,#10000000b,mm_tone_ver ; if equal m_tone_ver jmp mm_not_yetmm_tone_ver: mov r0,#max_active ; init maximun time to check mov@r0,#240 ; maximun sampling time 240*10ms=2.4s mov r0,#filter mov@r0,#10000000b mov io_m_a,#10000000b ; set mask for signal callverify_(—) ; calling to sub verify ; Check if test has been aborted bysliding the PCR jb test_enable,$+6 ljmp m_call_end2 clr c 70ms; subba,#05 ; if tone <50 tone invalid jc mm_not_yet ---Message sucessfullytransmitted to the TeleMaintenance Center ---and acknowledge receivedclr test_pending ; indicate that test was complete jmp m_call_end2 ;Exit routine mm_not_yet: call ext_watchdog mov a,time_1s ; no detectionyet jnz mm_check_inuse ; ****;m_tone_ok mov r0,#counter1 ; Cargamos ladireccion en r0. mov a,@r0 ; El contenido de la direccion ; alacumulador. dec a ; Decrementamos el contador mov @r0,a ; El contenidodecremetado a memoria. jz transmition_error ; Si el acumulador es cero,saltamos. jmp m_tone_ok  ;****; mm_check_inuse transmition_error: movR0,#main1_flag_error ; ****; mov a,@R0 or1 a,#00000010b ; set inuseerror mov @R0,a mov R0,#error_code mov @R0,#code_xmit_error mov a,#2call delay2 ; delay to show error lamps _call_end: jmp m_busy_ok_call_end2: mov a,#clear ; Clear code call wrbus ; clear any code inradio memory clr conn_loop ; present and on-hook call write_io_m_b ; anddisconnect module mov a,#1 call delay2 ; delay _wait_inuse_off: clrfremote_hup; **** ; not needed call hup setb fremote_hup; ****; mov a,#4call delay2 ; delay 4*2.5 sec setb mute jmp m_call_test_end _pre_onhook:_call_test_end: ret ;___ Function to check for T1 (10 secs) timer ;_(—)_The T1 timer is activated if at least 1 RingBack tone ;_(—)_ isdetected. ;_(—)_ Funtion returns carry flag on T1 time completion.Check_T1_Timer: mov r0,#count_tone mov a,@r0 cjne a,#0,tonedet jmpExitCheckT1 tonedet: ; At least 1 tone was previously detected mova,T1_Timer clr c subb a,#10 jc ExitCheckT1 setb c ret ExitCheckT1: clr cret Timer2/EXT2 Interrupt service routine ;Routine reads data from TRUand puts into ;appropriate storage locations int1_service: rdbus: CLR EApush psw push acc cont_checking_write: jb read,cont_read jnbSdata_tru,check_write setb read check_write: jb inte_enable,cont_writejnb write,check_message check_write2: clr sdata_cu ; indication forwrite setb inte_enable ; flag to indicate write sjmp check_messagecont_read: mov a,sdata_in ; read bit rr a mov c,Sdata_TRU mov acc.7,c ;Put data bit in acc mov sdata_in,a djnz bits_left in,check_write movbits_left_in,#8 clr read ; Prepare for next byte setb data_valid ;indicate 8 bits message sjmp check_write cont_write: mov a,sdata_out movc,acc.0 ; Shift out bit mov Sdata_CU,c ; Ditto rr a ; Rotate acc leftmov Sdata_out,a djnz bits_left_out,shift_next; Keep on til all 8 bitsout setb Sdata_CU clr write mov bits_left_out,#9 clr inte_enable ; flagto indicate write shift_next: mov a,sdata_in check_message: jbc datavalid,dataOK jmp rdbus_done ;----An 8 bit message was received. Decodemessage now. ;----Check for a previously expected message by checkingflags dataOK: jbc rssi,SaveRSSI ; is it previous rssi status jbcf_goodid,read_status ; is it previous message code 50 jbc f_60,msg_60 ;is it previous tari message 60 jbc f_61,msg_61 ; is it previous tarimessage 61 jbc f_62,msg_62 ; is it previous tari message 62 jbcf_63,msg_63 ; is it previous tari message 63 ;----No flags set, must bea new message or data ;----First check if bit 7 is set ;----if set,numbers are greater than 80 hex jnb acc.7,LessThan80hex ajmpGreaterThan80hex SaveRSSI: ; Radio signal strenght variable saving push0 mov r0,#signal_strength mov @r0,a pop 0 ajmp rdbus_done read_status: ;Indicators message received (Roam, NoService, Inuse) ; Save in, thecorresponding bit variables by using a fuzzy but fast method mov c,acc.2cpl c mov inuse,c mov c,acc.3 cpl c mov roam,c jnb acc.5,sserv clrnoserv clr ring_enable ; mant; enable ring after no service ajmprdbus_done sserv: setb noserv ajmp rdbus_done msg_60: push 0 movr0,#data_60 mov @r0,a pop 0 setb send_60 ajmp rdbus_done msg_61: push 0mov r0,#data_61 mov @r0,a pop 0 setb send_61 ajmp rdbus_done msg_62:push 0 mov r0,#data_62 mov @r0,a pop 0 setb send_62 ajmp rdbus_donemsg_63: push 0 mov r0,#data_63 mov @r0,a pop 0 setb send_63 ajmprdbus_done LessThan80Hex ;----Message Received is less than code 80 Hexcjne a,#51h,check_low_status setb rssi ; set rssi status ajmp rdbus_donecheck_low_status: cjne a,#50h,check_60 ; tari; if not 50 check statussetb f_goodid ; indicate message was 50 ajmp rdbus_done ; tari;vvvvvvvvvvvvvvvvvvvvvvvvvvvv check_60: jnb fcall,check60b ajmprdbus_done ; if incoming call do not check tariff check60b: cjnea,#60h,check_61 ; if not 60 check status setb f_60 ; indicate messagewas 60 ajmp rdbus_done check_61: cjne a,#61h,check_62 ; if not 61 checkstatus setb f_61 ; indicate message was 61 ajmp rdbus_done check_62:cjne a,#62h,check_63 ; if not 62 check status setb f_62 ; indicatemessage was 62 ajmp rdbus_done check_63: cjne a,#63h,Chk3 ; if not 63check status setb f_63 ; indicate message was 63 ajmp rdbus_done Chk3:cjne a,#03h,Chk2d setb power_on ajmp rdbus_done Chk2d: cjnea,#02dh,check_71 clr e_incoming clr a_incoming setb ap2 setb lock ajmprdbus_done Check_71: ; Telesupervisory (Audit) check cjne a,#71h,chk_73ajmp set_telesup_test ; Voice channel taken check chk_73: cjnea,#73h,chk_74 ajmp set_vch1 chk_74: cjne a,#74h,check_othersL ajmpset_vch2 chk_othersL: ajmp rdbus_done GreaterThan80hex: ;----- Value inaccumulator is greater than 80 hex jb acc.6,GreaterThan80Hex ; Number is(n >= c0h) if bit set jb acc.4,GreaterThan90Hex ; Number is (n >= 90h)if bit set ;----- Value in accumulator is in the range 80-8F or E0-EFcjne a,#085H,Check80to89Hex setb tru_is_on Check80to89Hex: clr c subba,#8ah jnc GreaterThan89 ; Number is (80h < n <= 89h), save in bufferfor telemaintenance. May be ; an expected memory contents number after amemory read command mov a,sdata_in ; Get digit again call save_dsp ; andsave in buffer ajmp rdbus_done GreaterThan89: ; Number is (8ah <= n =8fh or E0-EF): Invalid characters, not used. Exit now GreaterThan90Hex:cjne a,#095h,Chk91 setb e_incoming jnb a_incoming,not_incoming_e ;-----Incoming call receive sequence E−>A−>E (llamada EntrAntE) clr ap1 movccapm1,#0 clr e_incoming clr a_incoming not_incoming_e: ajmp rdbus_doneChk91: cjne a,#091h,Chk98 jnb e_incoming,Chk98 setb a_incoming ajmprdbus_done Chk98: cjne a,#098h,ChkBA clr lock ajmp rdbus_done ChkBA:cjne a,#0bah,ChkBB ;---- Incoming call (Tele maintenance) ---- jbring_enable_ChkBB ; mant;do not ring on init clr incoming_c ; mant; ajmprdbus_done ChkBB: cjne a,#0bbH,ChkOther ;----- Call dropped by radio,can be either a local or remote hangup ----- setb ap1 clr e_incoming clra_incoming ajmp rdbus_done ChkOther: ;----- No other checks will bedone, exit now ajmp rdbus_done GreaterThanC0Hex: ;----- No Specialcontrol messages with this code (C0-FF), exit now ajmp rdbus_done ;Audit (Test Activation by Telesupervision Center) set_telesup_test: setbaudit_code jb test_enable,rdbus_done push 0 mov R0,#call_back ;mant; anda new test is then perform mov. a,@r0 ,mant; anl a,#00110000b ,mant;clear counters, call incompleted orl a,#00000000b ;mant; keep previosled status and mov @R0,a ;mant; ring enable flag status movR0,#call_back2 ;mant; mov a,@R0 anl a,#00000000b ;mant; clearcounters,report incompleted orl a,#01100000b ; set invoked bytelesupervision mov @R0,a ;mant; setb test_enable setb init_test setbtest_pending pop 0 sjmp rdbus_done ;----- Voice channel taken, set vchbit ----- set_vch1: setb vch_1 sjmp rdbus_done set_vch2: setb vch_2 sjmprdbus_done rdbus_done: clr data_in clr ie1 SETB EA pop acc pop psw reti

What we claim is:
 1. An auto-diagnostic apparatus for testing the properfunctioning of a cellular, or cellular-like, transceiver and a cellular,or cellular-like, interface unit operatively coupled to said cellulartransceiver, which interface unit couples a land-type telephone deviceto the cellular transceiver whereby DTMF or pulse-type dialing signalsare converted into digital format for sending to said cellular, orcellular-like, transceiver, whereby the dialed number made on theland-type of telephone may be used to call a number over the cellular,or cellular-like, system, said apparatus comprising: auto-diagnosticmeans coupled to said interface unit for generating signals for testingthe operation of said cellular, or cellular-like, interface unit; meansfor generating a signal for initiating in said auto-diagnostic means theinitiation of the testing of the proper functioning of said cellular, orcellular-like, interface unit operatively coupled to said cellulartransceiver.
 2. The apparatus according to claim 1, wherein saidauto-diagnostic means also comprises means for testing the operation ofsaid cellular, or cellular-like, transceiver.
 3. In an apparatuscomprising a cellular, or cellular-like, transceiver and a cellular, orcellular-like, interface unit operatively coupled to said cellulartransceiver, which interface unit couples a land-type telephone deviceto the cellular transceiver whereby DTMF or pulse-type dialing signalsare converted into digital format for sending to said cellular, orcellular-like transceiver, whereby the dialed number made on theland-type of telephone may be used to call a number over the cellular,or cellular-like system, the improvement comprising: testing apparatuscomprising diagnostic means coupled to said interface unit forgenerating signals for testing the operation of said cellular, orcellular-like interface unit; initiating means for generating a signalfor initiating in said testing apparatus the initiation of the testingof the proper functioning or said cellular, or cellular-like interfaceunit operatively coupled to said cellular transceiver; said diagnosticmeans having signal-responsive means responsive to said signal from saidinitiating means for starting the testing process of testing apparatus.4. The apparatus according to claim 1, wherein said testing means alsocomprises means for testing the operation of said cellular, orcellular-like, transceiver.
 5. A method of testing for the properoperation of a cellular, or cellular-like, interface unit by means of adiagnostic unit, which cellular, or cellular-like, interface unit iscapable of being coupled to a land-type telephone or telephone-likeinstrument, said cellular, or cellular-like, interface unit capable ofconverting DTMF signals or pulse-type dialing signals from a land-typetelephone instrument coupled thereto into digital data format forsending the digital data to a cellular, or cellular-like transceiver,said method comprising: (a) sending a test-initiation signal to thediagnostic unit; (b) in response to said step (a), carrying out thetesting of the cellular, or cellular-like, interface unit by means ofthe diagnostic unit; (c) reporting the test-results data of said step(b); said step (b) comprising monitoring at least one function performedby said interface unit.